]> git.baikalelectronics.ru Git - kernel.git/commitdiff
x86/bugs: Flush IBP in ib_prctl_set()
authorRodrigo Branco <bsdaemon@google.com>
Tue, 3 Jan 2023 20:17:51 +0000 (14:17 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:59 +0000 (11:41 +0100)
commit a664ec9158eeddd75121d39c9a0758016097fa96 upstream.

We missed the window between the TIF flag update and the next reschedule.

Signed-off-by: Rodrigo Branco <bsdaemon@google.com>
Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/bugs.c

index 69d92ed52e4c9be1185c7f6215a86c4956dca2bc..8dca326a9e78a3ca189087f15f9cfb09aad0f234 100644 (file)
@@ -1787,6 +1787,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;