x86/head: Make empty_zero_page read-only
This makes the zero page read-only. It should have essentially no
overhead because it lives in the shiny new .robss..page_aligned
section.
While I'm at it, use ENDOBJECT to make the objdump output nicer.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index a2c7f1d..d717182 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -558,12 +558,16 @@
#endif
initial_pg_fixmap:
.fill 1024,4,0
-.globl empty_zero_page
-empty_zero_page:
- .fill 4096,1,0
.globl swapper_pg_dir
swapper_pg_dir:
.fill 1024,4,0
+
+__PAGE_ALIGNED_ROBSS
+.globl empty_zero_page
+.align PAGE_SIZE
+empty_zero_page:
+ .fill 4096,1,0
+ENDOBJECT(empty_zero_page)
EXPORT_SYMBOL(empty_zero_page)
/*
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index b467b14..f13eb18 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -496,8 +496,9 @@
#include "../../x86/xen/xen-head.S"
- __PAGE_ALIGNED_BSS
+ __PAGE_ALIGNED_ROBSS
NEXT_PAGE(empty_zero_page)
.skip PAGE_SIZE
+ENDOBJECT(empty_zero_page)
EXPORT_SYMBOL(empty_zero_page)