From 641d3e375f984db933af7fd52702181dcae27620 Mon Sep 17 00:00:00 2001 From: Rodrigo Branco Date: Thu, 9 Feb 2023 15:10:32 -0500 Subject: [PATCH] x86/bugs: Flush IBP in ib_prctl_set() We missed the window between the TIF flag update and the next reschedule. Signed-off-by: Rodrigo Branco Reviewed-by: Borislav Petkov (AMD) Signed-off-by: Ingo Molnar Cc: (cherry picked from commit a664ec9158eeddd75121d39c9a0758016097fa96) CVE-2023-0045 Signed-off-by: Yuxuan Luo Signed-off-by: Timo Aaltonen --- arch/x86/kernel/cpu/bugs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 2a21046846b6f..a0778e04d1f00 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1535,6 +1535,8 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) if (ctrl == PR_SPEC_FORCE_DISABLE) task_set_spec_ib_force_disable(task); task_update_spec_tif(task); + if (task == current) + indirect_branch_prediction_barrier(); break; default: return -ERANGE;