diff mbox series

[SRU,B/J/K/OEM-5.14/OEM-5.17/OEM-6.0,v2,1/1] x86/bugs: Flush IBP in ib_prctl_set()

Message ID 20230209201032.63188-2-yuxuan.luo@canonical.com
State New
Headers show
Series CVE-2023-0045 | expand

Commit Message

Yuxuan Luo Feb. 9, 2023, 8:10 p.m. UTC
From: Rodrigo Branco <bsdaemon@google.com>

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>
(cherry picked from commit a664ec9158eeddd75121d39c9a0758016097fa96)
CVE-2023-0045
Signed-off-by: Yuxuan Luo <yuxuan.luo@canonical.com>
---
 arch/x86/kernel/cpu/bugs.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thadeu Lima de Souza Cascardo Feb. 9, 2023, 8:20 p.m. UTC | #1
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Stefan Bader Feb. 10, 2023, 2:29 p.m. UTC | #2
On 09.02.23 21:10, Yuxuan Luo wrote:
> From: Rodrigo Branco <bsdaemon@google.com>
> 
> 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>
> (cherry picked from commit a664ec9158eeddd75121d39c9a0758016097fa96)
> CVE-2023-0045
> Signed-off-by: Yuxuan Luo <yuxuan.luo@canonical.com>
> ---
>   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 fc4bee4b17fb7..45f21906e7ab6 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -1776,6 +1776,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;

Applied to jammy:linux/master-next. Thanks.

-Stefan
diff mbox series

Patch

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index fc4bee4b17fb7..45f21906e7ab6 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1776,6 +1776,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;