From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 21/24] tegra124: Implement spl_was_boot_source()
Date: Tue, 05 May 2015 12:07:12 -0600 [thread overview]
Message-ID: <554906D0.7070001@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ3CdkKAUxjzMh6PZ9S1=XJK_dCa1-Qz9y+Qf1=v+vkNfQ@mail.gmail.com>
On 05/05/2015 10:19 AM, Simon Glass wrote:
> Hi Stephen,
>
> On 5 May 2015 at 10:10, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 05/05/2015 10:02 AM, Simon Glass wrote:
>>>
>>> Hi Stephen,
>>>
>>> On 5 May 2015 at 09:54, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>>>
>>>> On 05/04/2015 11:31 AM, Simon Glass wrote:
>>>>>
>>>>>
>>>>> Add an implementation of this function for Tegra.
>>>>
>>>>
>>>>
>>>>> diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c
>>>>
>>>>
>>>>
>>>>> +#ifndef CONFIG_SPL_BUILD
>>>>> +void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3)
>>>>> +{
>>>>> + from_spl = r0 != SPL_RUNNING_FROM_UBOOT;
>>>>> + save_boot_params_ret();
>>>>> +}
>>>>> +#endif
>>>>
>>>>
>>>>
>>>> (Using terminology from:
>>>> https://patchwork.ozlabs.org/patch/467771/
>>>> arm: spl: Enable detecting when U-Boot is started from SPL
>>>> )
>>>>
>>>> That doesn't look right. Surely (at least on Tegra), if the r/o U-Boot
>>>> chain-loads to the r/w U-Boot, then the chain-loaded U-Boot has no SPL
>>>> and
>>>> is just the main CPU build of U-Boot.
>>>>
>>>> Hence, "SPL_RUNNING_FROM_UBOOT" seems incorrectly named, since the r/o
>>>> U-Boot doesn't chain to SPL but rather to U-Boot.
>>>
>>>
>>> What name do you suggest? I was trying to add a prefix indicating that
>>> it relates to non-SPL start-up of U-Boot.
>>
>>
>> Well, that name specifically states that it's SPL that's running, whereas
>> the exact opposite is true.
>>
>> Perhaps UBOOT_CHAIN_LOADED_FROM_UBOOT?
>
> I really want to say that it is not chain-loaded from SPL. Maybe
> UBOOT_NOT_LOADED_FROM_SPL?
OK, that highlights that better.
>>>> This approach sounds a little brittle; what happens if r0 just happens to
>>>> have that value. Won't the code get confused?
>>>
>>>
>>> Yes, but SPL does not set that value in r0, and we have control over this.
>>>
>>>> Why does U-Boot care whether it's been chain-loaded? Shouldn't it always
>>>> behave identically in all cases, so it's independent of what caused it to
>>>> run?
>>>
>>>
>>> In the case of read-only U-Boot it must find the read-write one to
>>> jump to. In the case of read-write U-Boot it must boot a kernel.
>>
>>
>> Surely that should be taken care of by placing the correct boot scripts into
>> the U-Boot environment, rather than hard-coding specific boot behaviour into
>> the U-Boot binary?
>
> Two problems here:
>
> 1. The two U-Boot will use the same environment (as they are identical
> after all)
That's a design decision. There's absolutely no need for that to be true.
> 2. Loading the environment is a security risk (since anyone can change
> it in Linux, for example) so cannot be loaded.
Well, the environment could be the default/built-in environment and
hence validated as part of the validation of the U-Boot binary. Or, even
if loaded separately, could also be validated in the same way (but
perhaps there's not much point in that, since a fall-back to the
built-in environment would be required in case the external environment
validation failed).
>> This feature seems really use-case-specific; I wonder if it's
>> useful/generic-enough to upstream even?
>
> I am keen to upstream this use case (upgrading U-Boot in a secure way)
> as I think it has wide application.
OK. I worry that there are many many possible ways of doing that, and
the selection of the best option depends on the system use-cases,
security model, and environments. We might not want to lock people into
a specific method. So long as the existence of this code doesn't prevent
doing things some other way if they need, or upstreaming support for
other methods, nor make the code too complex, then it's probably fine.
next prev parent reply other threads:[~2015-05-05 18:07 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 17:30 [U-Boot] [PATCH 01/24] usb: add device connection/disconnection detection Simon Glass
2015-05-04 17:30 ` [U-Boot] [PATCH 02/24] dm: usb: Implement usb_detect_change() for driver model Simon Glass
2015-05-04 20:55 ` Joe Hershberger
2015-05-04 17:30 ` [U-Boot] [PATCH 03/24] bootstage: Add IDs for SPI flash reading and decompression Simon Glass
2015-05-04 20:57 ` Joe Hershberger
2015-05-08 5:58 ` Jagan Teki
2015-05-12 22:40 ` Simon Glass
2015-05-04 17:30 ` [U-Boot] [PATCH 04/24] dm: i2c: Implement 'i2c bus' command for driver model Simon Glass
2015-05-04 20:35 ` Joe Hershberger
2015-05-06 5:44 ` Heiko Schocher
2015-05-06 14:34 ` Simon Glass
2015-05-12 22:40 ` Simon Glass
2015-05-04 17:30 ` [U-Boot] [PATCH 05/24] dm: i2c: Add a function to find out the chip offset length Simon Glass
2015-05-04 20:43 ` Joe Hershberger
2015-05-06 5:37 ` Heiko Schocher
2015-05-12 22:40 ` Simon Glass
2015-05-04 17:30 ` [U-Boot] [PATCH 06/24] tpm: Support using driver model with I2C Simon Glass
2015-05-12 22:40 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 07/24] tpm: Rename Infineon TPM to slb9645tt Simon Glass
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 08/24] dm: gpio: Fix comment typo in GPIOD_IS_IN Simon Glass
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 09/24] arm: Include the .got section in the binary Simon Glass
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 10/24] arm: Add a prototype for save_boot_params_ret() Simon Glass
2015-05-04 21:09 ` Joe Hershberger
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 11/24] arm: spl: Enable detecting when U-Boot is started from SPL Simon Glass
2015-05-04 20:39 ` Joe Hershberger
2015-05-04 17:31 ` [U-Boot] [PATCH 12/24] arm: Allow cleanup_before_linux() without disabling caches Simon Glass
2015-05-04 17:36 ` Marek Vasut
2015-05-04 17:49 ` Simon Glass
2015-05-04 18:02 ` Marek Vasut
2015-05-04 17:31 ` [U-Boot] [PATCH 13/24] sandbox: Add an implementation for cleanup_before_linux_select() Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 14/24] sandbox: Correct error handling in state_read_file() Simon Glass
2015-05-04 21:12 ` Joe Hershberger
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 15/24] sandbox: Add missing errno.h includes in a few files Simon Glass
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 16/24] sandbox: cros_ec: Support EC_CMD_ENTERING_MODE emulation Simon Glass
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 17/24] sandbox: spi: Add newline to printf() in sandbox_sf_probe Simon Glass
2015-05-04 21:06 ` Joe Hershberger
2015-05-08 5:58 ` Jagan Teki
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 18/24] sandbox: Fix warning in display_options Simon Glass
2015-05-04 21:45 ` Joe Hershberger
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 19/24] sandbox: Support wide-screen LCD emulation Simon Glass
2015-05-04 21:27 ` Joe Hershberger
2015-05-04 21:36 ` Simon Glass
2015-05-12 22:41 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 20/24] lcd: Support colour lookup table on 16bpp display in BMP images Simon Glass
2015-05-04 21:42 ` Joe Hershberger
2015-05-04 17:31 ` [U-Boot] [PATCH 21/24] tegra124: Implement spl_was_boot_source() Simon Glass
2015-05-05 15:54 ` Stephen Warren
2015-05-05 16:02 ` Simon Glass
2015-05-05 16:10 ` Stephen Warren
2015-05-05 16:19 ` Simon Glass
2015-05-05 18:07 ` Stephen Warren [this message]
2015-05-06 19:04 ` Simon Glass
2015-05-04 17:31 ` [U-Boot] [PATCH 22/24] tegra: nyan-big: Allow TPM on I2C Simon Glass
2015-05-04 17:52 ` Stephen Warren
2015-05-04 17:31 ` [U-Boot] [PATCH 23/24] tegra: mmc: Set the removable flag correctly Simon Glass
2015-05-04 22:00 ` Joe Hershberger
2015-05-05 9:39 ` Pantelis Antoniou
2015-05-04 17:31 ` [U-Boot] [PATCH 24/24] tegra124: Expand SPL space by 8KB Simon Glass
2015-05-05 15:59 ` Stephen Warren
2015-05-05 16:03 ` Simon Glass
2015-05-05 16:12 ` Stephen Warren
2015-05-05 16:26 ` Simon Glass
2015-05-05 18:20 ` Stephen Warren
2015-05-06 19:04 ` Simon Glass
2015-05-05 16:03 ` Simon Glass
2015-05-05 16:13 ` Tom Warren
2015-05-12 22:40 ` [U-Boot] [PATCH 01/24] usb: add device connection/disconnection detection Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=554906D0.7070001@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox