U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: Richard Weinberger <richard@sigma-star.at>
Cc: Tom Rini <trini@konsulko.com>,
	 u-boot@lists.u-boot-project.org,
	 Marek Vasut <marex@nabladev.com>,
	 Fiona Klute <fiona.klute@gmx.de>,
	upstream+uboot@sigma-star.at
Subject: Re: [PATCH] doc: fix description of CONFIG_ENV_WRITEABLE_LIST
Date: Wed, 21 Oct 2026 09:28:34 +0200	[thread overview]
Message-ID: <87cxt31pi5.fsf@prevas.dk> (raw)
In-Reply-To: <maJhRK5WQ1CTiNrAorY2gw@sigma-star.at>

On Tue, Oct 20 2026, Richard Weinberger <richard@sigma-star.at> wrote:

> On Dienstag, 20. Oktober 2026 12:22 Marek Vasut wrote:
>> >> -	  writeable flag can be written and modified at runtime. No variables
>> >> -	  can be otherwise created, written or imported into the environment.
>> >> +	  writeable flag can be written from stored environment. This
>> >> +	  restricts only environment loading, not runtime modification using
>> >> +	  "env set", etc.
>> > 
>> > Wow, just wow.
>> > I always assumed that the protection applies also to "env import ..." too
>> > since the documentation explicitly said "written or imported into the environment".
>> > 
>> > Instead of fixing the documentation, are we sure that this isn't a serve (security)
>> > bug which needs addressing?
>> If the attacker has access to U-Boot shell, then they have unrestricted 
>> access to the system and it is over (the attacker can e.g. modify memory 
>> which can be used to circumvent other protections). For the writeable 
>> list to have any meaningful effect, U-Boot shell access must be disabled 
>> (e.g. bootdelay set to -2 or similar). The writeable list protects 
>> U-Boot from importing undesired data from the external environment.
>
> Well, I have a different use case in mind.
>
> What if you have something like this in your bootcmd: "env import -t ${loadaddr} ${filesize}"
> to import variables form a file like /boot/extraEnv.txt?
> I like this a lot because it allows applications to set various u-boot variables.
> And to make sure to allow only a trusted set of variables, CONFIG_ENV_WRITEABLE_LIST
> is configured to that set.

You can do this today, but not through ENV_WRITEABLE_LIST. If you give
'env import' extra arguments, those are treated as names of the (only)
variable settings in the imported env block to honour. So you can do

  env import -t ${loadaddr} ${filesize} ${safe_vars}

That can for example be used to have a completely static environment
(i.e. never store/load it to/from permanent storage), yet import the
metadata necessary for doing A/B slot selection from somewhere that
userspace can update when installing new firmware. Obviously, one should
also sanity check those imported variables, but the point is that one
doesn't risk the above command overwriting/setting $bootcmd or $verify
or similar. And if an attacker has had sufficient access to manipulate
whatever mechanism is used for communicating A/B metadata between
userspace and the bootloader, he could just as well have bricked the
device there and then.

Rasmus

  parent reply	other threads:[~2026-10-21  7:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  9:21 [PATCH] doc: fix description of CONFIG_ENV_WRITEABLE_LIST Fiona Klute
2026-10-20  9:51 ` Richard Weinberger
2026-10-20 10:22   ` Marek Vasut
2026-10-20 12:29     ` Richard Weinberger
2026-10-20 12:53       ` Marek Vasut
2026-10-20 12:55         ` Richard Weinberger
2026-10-20 18:16           ` Marek Vasut
2026-10-21 15:00             ` Jan Kiszka
2026-10-20 17:04       ` Massimo Pegorer
2026-10-20 17:21         ` Richard Weinberger
2026-10-20 18:38           ` Massimo Pegorer
2026-10-20 19:06             ` Fiona Klute
2026-10-21  7:28       ` Rasmus Villemoes [this message]
2026-10-21 16:56         ` Massimo Pegorer
2026-10-20 10:44 ` Marek Vasut

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=87cxt31pi5.fsf@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=fiona.klute@gmx.de \
    --cc=marex@nabladev.com \
    --cc=richard@sigma-star.at \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    --cc=upstream+uboot@sigma-star.at \
    /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