Re: [PATCH 3/4] x86/boot: Explicitly pass NX enabling status

From: Jürgen Groß
Date: Thu Apr 04 2024 - 06:33:44 EST


On 03.04.24 17:35, Dave Hansen wrote:
From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>

The kernel sometimes needs to mask unsupported bits out of page
table entries. It does that with a mask: '__supported_pte_mask'.

That mask can obviously only contain the No-eXecute bit (_PAGE_NX)
on hardware where NX is supported. x86_configure_nx() checks the
boot CPU's NX support and adjusts the mask appropriately.

But it doesn't check support directly. It uses the venerable
'boot_cpu_data' which is a software approximation of the actual CPU
support. Unfortunately, Xen wants to set up '__supported_pte_mask'
before 'boot_cpu_data' has been initialized. It hacks around this
problem by repeating some of the 'boot_cpu_data' setup *just* for
NX.

Have x86_configure_nx() stop consulting 'boot_cpu_data' and move
the NX detection to the caller.

No functional change. That will come later.

Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Reviewed-by: Kai Huang <kai.huang@xxxxxxxxx>

Reviewed-by: Juergen Gross <jgross@xxxxxxxx>


Juergen