The altinstr_aux section contains code that must remain when dynamic
mitigations are supported. Move it into the normal .text section so it is
not free'd when init memory is free'd.
Signed-off-by: David Kaplan <david.kaplan@amd.com>
---
arch/x86/kernel/vmlinux.lds.S | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index e0db3f4c97df..c4a0bb13d095 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -143,6 +143,9 @@ SECTIONS
*/
. = srso_alias_untrain_ret | (1 << 2) | (1 << 8) | (1 << 14) | (1 << 20);
*(.text..__x86.rethunk_safe)
+#endif
+#ifdef CONFIG_DYNAMIC_MITIGATIONS
+ *(.altinstr_aux)
#endif
ALIGN_ENTRY_TEXT_END
@@ -262,6 +265,7 @@ SECTIONS
INIT_TEXT_SECTION(PAGE_SIZE)
+#ifndef CONFIG_DYNAMIC_MITIGATIONS
/*
* Section for code used exclusively before alternatives are run. All
* references to such code must be patched out by alternatives, normally
@@ -272,8 +276,9 @@ SECTIONS
.altinstr_aux : AT(ADDR(.altinstr_aux) - LOAD_OFFSET) {
*(.altinstr_aux)
. = ALIGN(PAGE_SIZE);
- __inittext_end = .;
}
+#endif
+ __inittext_end = .;
INIT_DATA_SECTION(16)
--
2.34.1