Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

From: Borislav Petkov
Date: Wed Jan 20 2016 - 05:50:54 EST


On Tue, Jan 19, 2016 at 08:42:10PM -0800, H. Peter Anvin wrote:
> Right. I wish we could tag reference call sites as clean, not sources
> or targets. Sigh.

I was thinking about something like this:

From: Borislav Petkov <bp@xxxxxxx>
Date: Wed, 20 Jan 2016 11:45:36 +0100
Subject: [PATCH] x86/alternatives: Add an auxilary section

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 | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 74e4bf11f562..35868bf529b9 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -244,6 +244,11 @@ SECTIONS
*/
.altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
*(.altinstr_replacement)
+ /*
+ * Auxiliary section for misc instruction patching tasks. See
+ * static_cpu_has(), for an example.
+ */
+ *(.altinstr_aux)
}

/*
--
2.3.5

SUSE Linux GmbH, GF: Felix ImendÃrffer, Jane Smithard, Graham Norton, HRB 21284 (AG NÃrnberg)
--