[PATCH 4/5] x86/alternatives: Add an auxilary section

From: Borislav Petkov
Date: Thu Jan 21 2016 - 13:36:00 EST


From: Borislav Petkov <bp@xxxxxxx>

Add .altinstr_aux for additional instructions which will be used before
and/or during patching. All stuff which needs more sophisticated
patching should go there. See next patch.

Signed-off-by: Borislav Petkov <bp@xxxxxxx>
---
arch/x86/kernel/vmlinux.lds.S | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 74e4bf11f562..1335ff4854ae 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -244,6 +244,15 @@ SECTIONS
*/
.altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
*(.altinstr_replacement)
+ /*
+ * Section for code used exclusively before alternatives are
+ * run. All references to such code must be patched out by
+ * alternatives, normally by using a patch with
+ * X86_FEATURE_ALWAYS.
+ *
+ * See static_cpu_has() for an example.
+ */
+ *(.altinstr_aux)
}

/*
--
2.3.5