The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Frank Rowand <frowand.list@gmail.com>
Subject: Re: [PATCH] of: fdt: parse early params before adding bootloader randomness
Date: Mon, 7 Nov 2022 18:34:07 +0100	[thread overview]
Message-ID: <Y2lBj1ZIdFRf9HdR@zx2c4.com> (raw)
In-Reply-To: <CAL_JsqKA1_HV5V17mHkKn8X72c_UN2Jg=TYtJkt93YM6SSDMSg@mail.gmail.com>

On Mon, Nov 07, 2022 at 11:28:20AM -0600, Rob Herring wrote:
> On Fri, Nov 4, 2022 at 8:46 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> >
> > FDT is examined so early that it's before the first incidental call to
> > parse_early_param(). This is similar to EFI, except EFI actually added
> > an explicitly call to parse_early_param(). Let's do the same here, so
> > that specifying `random.trust_bootloader=0` is not ignored.
> >
> > Fixes: d97c68d178fb ("random: treat bootloader trust toggle the same way as cpu trust toggle")
> > Cc: Rob Herring <robh@kernel.org>
> > Cc: Frank Rowand <frowand.list@gmail.com>
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > ---
> >  drivers/of/fdt.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> > index 7b571a631639..6d959117fd4f 100644
> > --- a/drivers/of/fdt.c
> > +++ b/drivers/of/fdt.c
> > @@ -1195,6 +1195,9 @@ int __init early_init_dt_scan_chosen(char *cmdline)
> >
> >         rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
> >         if (rng_seed && l > 0) {
> > +               /* Parse random.trust_bootloader if it's in command line. */
> > +               parse_early_param();
> 
> I don't think it's good that the timing of calling this is dependent
> on "rng-seed" being present or not. So perhaps move it up to after the
> cmdline is set.
> 
> Either way, the other issue is the cmdline is not necessarily fixed at
> this point with some architectures doing their own
> append/prepend/override of the cmdline. We can't seem to get common
> implementation there finished. I'm doubtful that corner case would
> actually be hit though.

Hm, yea. I'm actually now having second thoughts about this one too for
other reasons: FDT isn't the only arch that has this issue. It's also a
problem on x86 and m68k. Maybe the random.trust_bootloader toggle should
just go away, since already your bootloader can do whatever it wants to
the kernel it executes? Not sure; I'll think on it a bit I guess...

Jason

  reply	other threads:[~2022-11-07 17:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05  1:46 [PATCH] of: fdt: parse early params before adding bootloader randomness Jason A. Donenfeld
2022-11-07 17:28 ` Rob Herring
2022-11-07 17:34   ` Jason A. Donenfeld [this message]
2022-11-18  8:33     ` Rasmus Villemoes
2022-11-18  9:09       ` Jason A. Donenfeld

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=Y2lBj1ZIdFRf9HdR@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /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