[PATCH v5 01/27] x86/boot: Align vmlinuz sections on page size
From: Evgeniy Baskov
Date: Tue Mar 14 2023 - 06:15:59 EST
To protect sections on page table level each section needs to be
aligned on page size (4KB).
Set sections alignment in linker script for the kernel decompressor
(boot/compressed/vmlinux.lds.S).
Also introduce symbols that can be used to reference compressed
kernel blob section later in the later patches.
Tested-by: Mario Limonciello <mario.limonciello@xxxxxxx>
Signed-off-by: Evgeniy Baskov <baskov@xxxxxxxxx>
---
arch/x86/boot/compressed/vmlinux.lds.S | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S
index b22f34b8684a..a5015b958085 100644
--- a/arch/x86/boot/compressed/vmlinux.lds.S
+++ b/arch/x86/boot/compressed/vmlinux.lds.S
@@ -27,31 +27,32 @@ SECTIONS
HEAD_TEXT
_ehead = . ;
}
- .rodata..compressed : {
+ .rodata..compressed : ALIGN(PAGE_SIZE) {
+ _compressed = .;
*(.rodata..compressed)
+ _ecompressed = .;
}
- .text : {
+ .text : ALIGN(PAGE_SIZE) {
_text = .; /* Text */
*(.text)
*(.text.*)
*(.noinstr.text)
_etext = . ;
}
- .rodata : {
+ .rodata : ALIGN(PAGE_SIZE) {
_rodata = . ;
*(.rodata) /* read-only data */
*(.rodata.*)
_erodata = . ;
}
- .data : {
+ .data : ALIGN(PAGE_SIZE) {
_data = . ;
*(.data)
*(.data.*)
*(.bss.efistub)
_edata = . ;
}
- . = ALIGN(L1_CACHE_BYTES);
- .bss : {
+ .bss : ALIGN(L1_CACHE_BYTES) {
_bss = . ;
*(.bss)
*(.bss.*)
@@ -60,8 +61,7 @@ SECTIONS
_ebss = .;
}
#ifdef CONFIG_X86_64
- . = ALIGN(PAGE_SIZE);
- .pgtable : {
+ .pgtable : ALIGN(PAGE_SIZE) {
_pgtable = . ;
*(.pgtable)
_epgtable = . ;
--
2.39.2