[PATCH v7 06/14] x86/cet/ibt: ELF header parsing for IBT

From: Yu-cheng Yu
Date: Thu Jun 06 2019 - 16:22:08 EST


Look in .note.gnu.property of an ELF file and check if Indirect
Branch Tracking needs to be enabled for the task.

Signed-off-by: Yu-cheng Yu <yu-cheng.yu@xxxxxxxxx>
---
arch/x86/kernel/process_64.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 5fa0d9ab18f1..16dae646f633 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -856,6 +856,12 @@ int arch_setup_property(void *ehdr, void *phdr, struct file *f, bool inter)
if (r < 0)
return r;
}
+
+ if (cpu_feature_enabled(X86_FEATURE_IBT)) {
+ if (property & GNU_PROPERTY_X86_FEATURE_1_IBT)
+ r = cet_setup_ibt();
+ }
+
return r;
}
#endif
--
2.17.1