Skip to content
Snippets Groups Projects
  1. Aug 22, 2024
  2. Aug 11, 2024
  3. Jul 31, 2024
    • Simon Glass's avatar
      usb: bootm: Drop old USB-device-removal code · 59ca3a2f
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      USB is stopped using driver model now, in dm_remove_devices_flags() in
      announce_and_cleanup() at the top of this file.
      
      The usb_stop() call actually unbinds devices.
      
      When a USB device is unbound, it causes any bootflows attached to it to
      be removed, via a call to bootdev_clear_bootflows() from
      bootdev_pre_unbind(). This obviously makes it impossible to boot the
      bootflow.
      
      However, when booting a bootflow that relies on USB, usb_stop() is
      called, which unbinds the device. At that point any information
      attached to the bootflow is dropped.
      
      This is quite risky since the contents of freed memory are not
      guaranteed to remain unchanged. Depending on what other options are
      done before boot, a hard-to-find bug may crop up.
      
      Drop the call to this old function.
      
      Leave the netconsole call there, since this needs conversion to
      driver model.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Suggested-by: default avatarShantur Rathore <i@shantur.com>
      Reviewed-by: default avatarMattijs Korpershoek <mkorpershoek@baylibre.com>
      59ca3a2f
  4. Jul 19, 2024
  5. Jul 18, 2024
  6. Jul 16, 2024
  7. Jul 15, 2024
  8. Jul 12, 2024
    • This contributor prefers not to receive mails's avatar
      powerpc: Add support for CZ.NIC Turris 1.x routers · f4158203
      This contributor prefers not to receive mails authored and Tom Rini's avatar Tom Rini committed
      Add support for CZ.NIC Turris 1.x routers.
      
      CZ.NIC Turris 1.0 (RTRS01) and 1.1 (RTRS02) are open source routers, they
      have dual-core PowerPC Freescale P2020 CPU and are based on reference
      Freescale P2020RDB-PC-A board design.
      
      Hardware design is fully open source, all firmware and hardware design
      files are available at Turris project website:
      
      https://docs.turris.cz/hw/turris-1x/turris-1x/
      https://project.turris.cz/en/hardware.html
      
      
      
      The P2020 BootROM can load U-Boot either from NOR flash or from SD card.
      We add the new defconfigs, turris_1x_nor_defconfig, which configures
      U-Boot for building the NOR image, and turris_1x_sdcard_defconfig, which
      configures U-Boot for building an image suitable for SD card.
      
      The defconfig for NOR image is stripped-down a - many config options
      enabled in SD defconfig are disabled for NOR defconfig. This is because
      U-Boot grew non-trivially in the last two years and it would not fit
      into the space allocated for U-Boot in the NOR memory. In the future we
      may try to use LTO to reduce the size of the code and enable more
      options.
      
      The design of CZ.NIC Turris 1.x routers is based on Freescale P2020RDB-PC-A
      board, so some code from boards/freescale/p1_p2_rdb_pc is used and linked
      into Turris 1.x board code.
      
      Turris 1.x code in this patch uses modern distroboot and can boot Linux
      kernel from various locations, including NAND, SD card, USB flash disks,
      NVMe disks or SATA disks (connected to extra SATA/SCSI PCIe controllers).
      Via distroboot is implemented also rescue NOR boot for factory recovery,
      triggered by reset button, like on other existing Turris routers.
      
      SD boot with RAM larger than 2GB will only allocate 2GB of RAM (We were
      not able to fix this yet)
      
      [ Because various CONFIG_ macros were migrated to Kconfig since the last
        time this worked on upstream U-Boot (in 2022), a non-trivial rebasing
        was needed and some issues were solved. ]
      
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Signed-off-by: default avatarMarek Mojík <marek.mojik@nic.cz>
      Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
      f4158203
  9. Jul 05, 2024
  10. Jul 03, 2024
  11. Jun 30, 2024
    • Ilias Apalodimas's avatar
      tpm: allow the user to select the compiled algorithms · e7505b3b
      Ilias Apalodimas authored and Heinrich Schuchardt's avatar Heinrich Schuchardt committed
      
      Simon reports that after enabling all algorithms on the TPM some boards
      fail since they don't have enough storage to accommodate the ~5KB growth.
      
      The choice of hash algorithms is determined by the platform and the TPM
      configuration. Failing to cap a PCR in a bank which the platform left
      active is a security vulnerability. It might allow  unsealing of secrets
      if an attacker can replay a good set of measurements into an unused bank.
      
      If MEASURED_BOOT or EFI_TCG2_PROTOCOL is enabled our Kconfig will enable
      all supported hashing algorithms. We still want to allow users to add a
      TPM and not enable measured boot via EFI or bootm though and at the same
      time, control the compiled algorithms for size reasons.
      
      So let's add a function tpm2_allow_extend() which checks the TPM active
      PCRs banks against the one U-Boot was compiled with. We only allow
      extending PCRs if the algorithms selected during build match the TPM
      configuration.
      
      It's worth noting that this is only added for TPM2.0, since TPM1.2 is
      lacking a lot of code at the moment to read the available PCR banks.
      We unconditionally enable SHA1 when a TPM is selected, which is the only
      hashing algorithm v1.2 supports.
      
      Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Tested-by: Simon Glass <sjg@chromium.org>  # chromebook-link
      e7505b3b
    • Ilias Apalodimas's avatar
      tpm: Move TCG headers into a separate file · 27b462ce
      Ilias Apalodimas authored and Heinrich Schuchardt's avatar Heinrich Schuchardt committed
      
      commit 97707f12 ("tpm: Support boot measurements") moved out code
      from the EFI subsystem into the TPM one to support measurements when
      booting with !EFI.
      
      Those were moved directly into the TPM subsystem and in the tpm-v2.c
      library. In hindsight, it would have been better to move it in new
      files since the TCG2 is governed by its own spec, it's overeall cleaner
      and also easier to enable certain parts of the TPM functionality.
      
      So let's start moving the headers in a new file containing the TCG
      specific bits.
      
      Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      27b462ce
  12. Jun 28, 2024
    • Tim Harvey's avatar
      use fdt_kaslrseed function to de-duplicate code · 909321bc
      Tim Harvey authored and Tom Rini's avatar Tom Rini committed
      
      Use the fdt_kaslrseed function to deduplicate code doing the same thing.
      
      Note that the kalsrseed command (CMD_KASLRSEED) is likely pointless now
      but left in place in case boot scripts exist that rely on this command
      existing and returning success. An informational message is printed to
      alert users of this command that it is likely no longer needed.
      
      Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for
      randomization and completely ignores the kaslr-seed for its own
      randomness needs (i.e the randomization of the physical placement of
      the kernel). It gets weeded out from the DTB that gets handed over via
      efi_install_fdt() as it would also mess up the measured boot DTB TPM
      measurements as well.
      
      Signed-off-by: default avatarTim Harvey <tharvey@gateworks.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Cc: Michal Simek <michal.simek@amd.com>
      Cc: Andy Yan <andy.yan@rock-chips.com>
      Cc: Akash Gajjar <gajjar04akash@gmail.com>
      Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
      Cc: Simon Glass <sjg@chromium.org>
      Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
      Cc: Patrice Chotard <patrice.chotard@foss.st.com>
      Cc: Devarsh Thakkar <devarsht@ti.com>
      Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
      Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Tom Rini <trini@konsulko.com>
      Cc: Chris Morgan <macromorgan@hotmail.com>
      Acked-by: default avatarMichal Simek <michal.simek@amd.com>
      909321bc
    • Tim Harvey's avatar
      fdt: automatically add /chosen/kaslr-seed if DM_RNG is enabled · ea955eea
      Tim Harvey authored and Tom Rini's avatar Tom Rini committed
      
      If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to
      randomize the virtual address at which the kernel image is loaded, it
      expects entropy to be provided by the bootloader by populating
      /chosen/kaslr-seed with a 64-bit value from source of entropy at boot.
      
      If we have DM_RNG enabled populate this value automatically when
      fdt_chosen is called. We skip this if ARMV8_SEC_FIRMWARE_SUPPORT
      is enabled as its implementation uses a different source of entropy
      that is not yet implemented as DM_RNG. We also skip this if
      MEASURED_BOOT is enabled as in that case any modifications to the
      dt will cause measured boot to fail (although there are many other
      places the dt is altered).
      
      Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for
      randomization and completely ignores the kaslr-seed for its own
      randomness needs (i.e the randomization of the physical placement of
      the kernel). It gets weeded out from the DTB that gets handed over via
      efi_install_fdt() as it would also mess up the measured boot DTB TPM
      measurements as well.
      
      Signed-off-by: default avatarTim Harvey <tharvey@gateworks.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Cc: Michal Simek <michal.simek@amd.com>
      Cc: Andy Yan <andy.yan@rock-chips.com>
      Cc: Akash Gajjar <gajjar04akash@gmail.com>
      Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
      Cc: Simon Glass <sjg@chromium.org>
      Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
      Cc: Patrice Chotard <patrice.chotard@foss.st.com>
      Cc: Devarsh Thakkar <devarsht@ti.com>
      Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
      Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Tom Rini <trini@konsulko.com>
      Cc: Chris Morgan <macromorgan@hotmail.com>
      ea955eea
    • Tim Harvey's avatar
      Add fdt_kaslrseed function to add kaslr-seed to chosen node · 00afd1ec
      Tim Harvey authored and Tom Rini's avatar Tom Rini committed
      
      If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to
      randomize the virtual address at which the kernel image is loaded, it
      expects entropy to be provided by the bootloader by populating
      /chosen/kaslr-seed with a 64-bit value from source of entropy at boot.
      
      Add a fdt_kaslrseed function to accommodate this allowing an existing
      node to be overwritten if present. For now use the first rng device
      but it would be good to enhance this in the future to allow some sort
      of selection or policy in choosing the rng device used.
      
      Signed-off-by: default avatarTim Harvey <tharvey@gateworks.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Cc: Michal Simek <michal.simek@amd.com>
      Cc: Andy Yan <andy.yan@rock-chips.com>
      Cc: Akash Gajjar <gajjar04akash@gmail.com>
      Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
      Cc: Simon Glass <sjg@chromium.org>
      Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
      Cc: Patrice Chotard <patrice.chotard@foss.st.com>
      Cc: Devarsh Thakkar <devarsht@ti.com>
      Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
      Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Tom Rini <trini@konsulko.com>
      Cc: Chris Morgan <macromorgan@hotmail.com>
      Reviewed-by: default avatarCaleb Connolly <caleb.connolly@linaro.org>
      00afd1ec
    • Simon Glass's avatar
      tpm: Avoid code bloat when not using EFI_TCG2_PROTOCOL · 092b6ec6
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      It does not make sense to enable all SHA algorithms unless they are
      needed. It bloats the code and in this case, causes chromebook_link to
      fail to build. That board does use the TPM, but not with measured boot,
      nor EFI.
      
      Since EFI_TCG2_PROTOCOL already selects these options, we just need to
      add them to MEASURED_BOOT as well.
      
      Note that the original commit combines refactoring and new features,
      which makes it hard to see what is going on.
      
      Fixes: 97707f12 tpm: Support boot measurements
      Reviewed-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      092b6ec6
  13. Jun 26, 2024
  14. Jun 22, 2024
  15. Jun 20, 2024
  16. Jun 16, 2024
  17. Jun 10, 2024
  18. Jun 07, 2024
  19. May 22, 2024
  20. May 20, 2024
  21. May 19, 2024
  22. May 06, 2024
  23. May 05, 2024
  24. Apr 21, 2024
Loading