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...@intel.com>
---
 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

Reply via email to