diff mbox series

[2/3] x86/mm: Move base_disallow_mask into __ro_after_init

Message ID 20240717161415.3586195-3-andrew.cooper3@citrix.com (mailing list archive)
State New
Headers show
Series XSA-402 followup | expand

Commit Message

Andrew Cooper July 17, 2024, 4:14 p.m. UTC
base_disallow_mask is calculated once in arch_init_memory() and never changes
thereafter.  Write-protect it at runtime.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jan Beulich July 18, 2024, 9:26 a.m. UTC | #1
On 17.07.2024 18:14, Andrew Cooper wrote:
> base_disallow_mask is calculated once in arch_init_memory() and never changes
> thereafter.  Write-protect it at runtime.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 0ecea0f707b2..95795567f2a5 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -150,7 +150,8 @@  bool __read_mostly machine_to_phys_mapping_valid;
 
 struct rangeset *__read_mostly mmio_ro_ranges;
 
-static uint32_t base_disallow_mask;
+static uint32_t __ro_after_init base_disallow_mask;
+
 /* Global bit is allowed to be set on L1 PTEs. Intended for user mappings. */
 #define L1_DISALLOW_MASK ((base_disallow_mask | _PAGE_GNTTAB) & ~_PAGE_GLOBAL)