aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/bugs.c12
-rw-r--r--arch/x86/kernel/process.c12
2 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 01874d54f4fd..2da82eff0eb4 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -798,15 +798,25 @@ static int ssb_prctl_set(struct task_struct *task, unsigned long ctrl)
798 if (task_spec_ssb_force_disable(task)) 798 if (task_spec_ssb_force_disable(task))
799 return -EPERM; 799 return -EPERM;
800 task_clear_spec_ssb_disable(task); 800 task_clear_spec_ssb_disable(task);
801 task_clear_spec_ssb_noexec(task);
801 task_update_spec_tif(task); 802 task_update_spec_tif(task);
802 break; 803 break;
803 case PR_SPEC_DISABLE: 804 case PR_SPEC_DISABLE:
804 task_set_spec_ssb_disable(task); 805 task_set_spec_ssb_disable(task);
806 task_clear_spec_ssb_noexec(task);
805 task_update_spec_tif(task); 807 task_update_spec_tif(task);
806 break; 808 break;
807 case PR_SPEC_FORCE_DISABLE: 809 case PR_SPEC_FORCE_DISABLE:
808 task_set_spec_ssb_disable(task); 810 task_set_spec_ssb_disable(task);
809 task_set_spec_ssb_force_disable(task); 811 task_set_spec_ssb_force_disable(task);
812 task_clear_spec_ssb_noexec(task);
813 task_update_spec_tif(task);
814 break;
815 case PR_SPEC_DISABLE_NOEXEC:
816 if (task_spec_ssb_force_disable(task))
817 return -EPERM;
818 task_set_spec_ssb_disable(task);
819 task_set_spec_ssb_noexec(task);
810 task_update_spec_tif(task); 820 task_update_spec_tif(task);
811 break; 821 break;
812 default: 822 default:
@@ -885,6 +895,8 @@ static int ssb_prctl_get(struct task_struct *task)
885 case SPEC_STORE_BYPASS_PRCTL: 895 case SPEC_STORE_BYPASS_PRCTL:
886 if (task_spec_ssb_force_disable(task)) 896 if (task_spec_ssb_force_disable(task))
887 return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE; 897 return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE;
898 if (task_spec_ssb_noexec(task))
899 return PR_SPEC_PRCTL | PR_SPEC_DISABLE_NOEXEC;
888 if (task_spec_ssb_disable(task)) 900 if (task_spec_ssb_disable(task))
889 return PR_SPEC_PRCTL | PR_SPEC_DISABLE; 901 return PR_SPEC_PRCTL | PR_SPEC_DISABLE;
890 return PR_SPEC_PRCTL | PR_SPEC_ENABLE; 902 return PR_SPEC_PRCTL | PR_SPEC_ENABLE;
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 90ae0ca51083..58ac7be52c7a 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -255,6 +255,18 @@ void arch_setup_new_exec(void)
255 /* If cpuid was previously disabled for this task, re-enable it. */ 255 /* If cpuid was previously disabled for this task, re-enable it. */
256 if (test_thread_flag(TIF_NOCPUID)) 256 if (test_thread_flag(TIF_NOCPUID))
257 enable_cpuid(); 257 enable_cpuid();
258
259 /*
260 * Don't inherit TIF_SSBD across exec boundary when
261 * PR_SPEC_DISABLE_NOEXEC is used.
262 */
263 if (test_thread_flag(TIF_SSBD) &&
264 task_spec_ssb_noexec(current)) {
265 clear_thread_flag(TIF_SSBD);
266 task_clear_spec_ssb_disable(current);
267 task_clear_spec_ssb_noexec(current);
268 speculation_ctrl_update(task_thread_info(current)->flags);
269 }
258} 270}
259 271
260static inline void switch_to_bitmap(struct thread_struct *prev, 272static inline void switch_to_bitmap(struct thread_struct *prev,