[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMj1kXESAk4ZT_HAFaWQJLmyo9CyFYbRsToEXagPygBpFhDZiw@mail.gmail.com>
Date: Sat, 10 May 2025 16:51:07 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: David Laight <david.laight.linux@...il.com>
Cc: Ard Biesheuvel <ardb+git@...gle.com>, linux-kernel@...r.kernel.org, x86@...nel.org,
Ingo Molnar <mingo@...nel.org>, Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [RFC PATCH 2/3] x86/boot: Set __pgtable_l5_enabled correctly
before calling into C code
On Sat, 10 May 2025 at 15:54, David Laight <david.laight.linux@...il.com> wrote:
>
> On Tue, 6 May 2025 17:45:35 +0200
> Ard Biesheuvel <ardb+git@...gle.com> wrote:
>
> > From: Ard Biesheuvel <ardb@...nel.org>
> >
> > Ensure that __pgtable_l5_enabled() is set to its permanent value before
> > calling into any C code that may manipulate page tables or reference any
> > global variable or object that may be dimensioned differently based on
> > whether 5-level paging is in use.
> ...
> > #ifdef CONFIG_X86_5LEVEL
> > -/* __pgtable_l5_enabled needs to be in .data to avoid being cleared along with .bss */
> > -unsigned int __section(".data") __pgtable_l5_enabled;
> > +unsigned int __pgtable_l5_enabled = 1;
> > +
> > +/* These need to be in .data to avoid being cleared along with .bss */
> > unsigned int __section(".data") pgdir_shift = 39;
> > unsigned int __section(".data") ptrs_per_p4d = 1;
>
> Is that comment (and the section assignment) relevant given that they
> are initialised non-zero?
>
Excellent point - no, they are not.
> I'd guess that __pgtable_l5_enabled was getting set before .bss was cleared?
>
Yes.
Powered by blists - more mailing lists