lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACePvbV-vVXPxj1zdbHd_7gfYV3e=Ej52FphYhw_8_V_pNMTjw@mail.gmail.com>
Date: Thu, 23 Oct 2025 11:30:47 -0700
From: Chris Li <chrisl@...nel.org>
To: Ard Biesheuvel <ardb@...nel.org>
Cc: Michal Clapinski <mclapinski@...gle.com>, Thomas Gleixner <tglx@...utronix.de>, 
	Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, 
	Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org, 
	"H. Peter Anvin" <hpa@...or.com>, Dan Williams <dan.j.williams@...el.com>, 
	Pasha Tatashin <pasha.tatashin@...een.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] x86/boot/compressed: Fix avoiding memmap in
 physical KASLR

On Thu, Oct 23, 2025 at 1:25 AM Ard Biesheuvel <ardb@...nel.org> wrote:
>
> Hi Michal,
>
> Thanks for the patch.
>
> On Thu, 23 Oct 2025 at 01:37, Michal Clapinski <mclapinski@...gle.com> wrote:
>
> > Signed-off-by: Michal Clapinski <mclapinski@...gle.com>
> > Suggested-by: Chris Li <chrisl@...nel.org>
> > Fixes: d52e7d5a952c ("x86/KASLR: Parse all 'memmap=' boot option entries")
> > ---
> > The patch was suggested by Chris and I modified it a little without his
> > knowledge. I don't know which tags are appropriate.
>
> I think this is fine, unless Chris has a different opinion? In any

No objection. I recall I had a discussion with Michal in which I
wanted to simplify the global variable "memmap_too_large" state
machine but failed at keeping it meaningfully simpler and also covered
all the corner cases. Nice try on my side I guess.

Right now the memmap_too_large state machine is still a bit tricky to
understand the precise execution flow, but it is the best we can do.

Acked-by: Chris Li <chrisl@...nel.org>

Chris

> case, you might add a link to the original submission.
>
>
> > ---
> >  arch/x86/boot/compressed/kaslr.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
> > index 3b0948ad449f..649264503ce6 100644
> > --- a/arch/x86/boot/compressed/kaslr.c
> > +++ b/arch/x86/boot/compressed/kaslr.c
> > @@ -162,14 +162,18 @@ static void mem_avoid_memmap(char *str)
> >  {
> >         static int i;
> >
> > -       if (i >= MAX_MEMMAP_REGIONS)
> > -               return;
> > -
> > -       while (str && (i < MAX_MEMMAP_REGIONS)) {
> > +       while (str) {
> >                 int rc;
> >                 u64 start, size;
> > -               char *k = strchr(str, ',');
> > +               char *k;
> > +
> > +               if (i >= MAX_MEMMAP_REGIONS) {
> > +                       /* Too many memmap regions, disable physical KASLR. */
> > +                       memmap_too_large = true;
> > +                       return;
> > +               }
> >
> > +               k = strchr(str, ',');
> >                 if (k)
> >                         *k++ = 0;
> >
> > @@ -190,10 +194,6 @@ static void mem_avoid_memmap(char *str)
> >                 mem_avoid[MEM_AVOID_MEMMAP_BEGIN + i].size = size;
> >                 i++;
> >         }
> > -
> > -       /* More than 4 memmaps, fail kaslr */
> > -       if ((i >= MAX_MEMMAP_REGIONS) && str)
> > -               memmap_too_large = true;
> >  }
> >
> >  /* Store the number of 1GB huge pages which users specified: */
> > --
> > 2.51.1.814.gb8fa24458f-goog
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ