lkml.org 
[lkml]   [2019]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v7 04/14] x86/cet/ibt: Handle signals for IBT
Date
Setup/Restore Indirect Branch Tracking for signals.

Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
---
arch/x86/kernel/cet.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/arch/x86/kernel/cet.c b/arch/x86/kernel/cet.c
index e0ef996d3148..e1ab7e722637 100644
--- a/arch/x86/kernel/cet.c
+++ b/arch/x86/kernel/cet.c
@@ -282,6 +282,15 @@ int cet_restore_signal(bool ia32, struct sc_ext *sc_ext)
msr_ia32_u_cet |= MSR_IA32_CET_SHSTK_EN;
}

+ if (current->thread.cet.ibt_enabled) {
+ if (current->thread.cet.ibt_bitmap_addr != 0)
+ msr_ia32_u_cet |= (current->thread.cet.ibt_bitmap_addr |
+ MSR_IA32_CET_LEG_IW_EN);
+
+ msr_ia32_u_cet |= (MSR_IA32_CET_ENDBR_EN |
+ MSR_IA32_CET_NO_TRACK_EN);
+ }
+
wrmsrl(MSR_IA32_PL3_SSP, new_ssp);
wrmsrl(MSR_IA32_U_CET, msr_ia32_u_cet);
return 0;
@@ -322,6 +331,15 @@ int cet_setup_signal(bool ia32, unsigned long rstor_addr, struct sc_ext *sc_ext)
sc_ext->ssp = new_ssp;
}

+ if (current->thread.cet.ibt_enabled) {
+ if (current->thread.cet.ibt_bitmap_addr != 0)
+ msr_ia32_u_cet |= (current->thread.cet.ibt_bitmap_addr |
+ MSR_IA32_CET_LEG_IW_EN);
+
+ msr_ia32_u_cet |= (MSR_IA32_CET_ENDBR_EN |
+ MSR_IA32_CET_NO_TRACK_EN);
+ }
+
modify_fpu_regs_begin();
wrmsrl(MSR_IA32_PL3_SSP, ssp);
wrmsrl(MSR_IA32_U_CET, msr_ia32_u_cet);
--
2.17.1
\
 
 \ /
  Last update: 2019-06-06 22:17    [W:0.133 / U:9.992 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site