mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Ard Biesheuvel <ardb+git@google.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Ard Biesheuvel <ardb@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [RFC PATCH 2/3] x86/boot: Set __pgtable_l5_enabled correctly before calling into C code
Date: Sat, 10 May 2025 14:54:49 +0100	[thread overview]
Message-ID: <20250510145449.4117af82@pumpkin> (raw)
In-Reply-To: <20250506154532.1281909-7-ardb+git@google.com>

On Tue,  6 May 2025 17:45:35 +0200
Ard Biesheuvel <ardb+git@google.com> wrote:

> From: Ard Biesheuvel <ardb@kernel.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?

I'd guess that __pgtable_l5_enabled was getting set before .bss was cleared?

	David

  reply	other threads:[~2025-05-10 13:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06 15:45 [RFC PATCH 0/3] x86: Robustify pgtable_l5_enabled() Ard Biesheuvel
2025-05-06 15:45 ` [RFC PATCH 1/3] x86/boot: Use a single source of truth for pgtable_l5_enabled() Ard Biesheuvel
2025-05-06 15:45 ` [RFC PATCH 2/3] x86/boot: Set __pgtable_l5_enabled correctly before calling into C code Ard Biesheuvel
2025-05-10 13:54   ` David Laight [this message]
2025-05-10 14:51     ` Ard Biesheuvel
2025-05-06 15:45 ` [RFC PATCH 3/3] x86/boot: Use alternatives based selector for 5-level paging constants Ard Biesheuvel
2025-05-06 16:23   ` Linus Torvalds
2025-05-06 16:34     ` Ard Biesheuvel
2025-05-06 17:03       ` Linus Torvalds
2025-05-06 17:25         ` Ard Biesheuvel
2025-05-06 17:39           ` Ingo Molnar
2025-05-06 17:47             ` Ard Biesheuvel
2025-05-06 17:43           ` Linus Torvalds
2025-05-06 17:52             ` Ard Biesheuvel
2025-05-06 18:17               ` Linus Torvalds
2025-05-06 18:39                 ` Linus Torvalds
2025-05-06 19:14                   ` Ard Biesheuvel
2025-05-06 19:41                     ` Linus Torvalds
2025-05-06 19:50                       ` Ard Biesheuvel
2025-05-07 13:51                         ` Ard Biesheuvel
2025-05-06 16:50   ` Ingo Molnar
2025-05-06 16:58     ` Ard Biesheuvel

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=20250510145449.4117af82@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@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

Powered by JetHome