[PATCH] arm64: treat PF_IO_WORKER like PF_KTHREAD for mitigations

Will Deacon will at kernel.org
Thu Jan 26 06:00:18 PST 2023


On Wed, Jan 25, 2023 at 09:43:34AM -0700, Jens Axboe wrote:
> Like PF_KTHREAD, PF_IO_WORKER never exit to userspace. They exist
> entirely within the kernel, and hence don't need any task mitigations
> applied.
> 
> Signed-off-by: Jens Axboe <axboe at kernel.dk>
> 
> ---
> 
> diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c
> index fca9cc6f5581..25a21c3d446c 100644
> --- a/arch/arm64/kernel/proton-pack.c
> +++ b/arch/arm64/kernel/proton-pack.c
> @@ -654,7 +654,7 @@ static void __update_pstate_ssbs(struct pt_regs *regs, bool state)
>  void spectre_v4_enable_task_mitigation(struct task_struct *tsk)
>  {
>  	struct pt_regs *regs = task_pt_regs(tsk);
> -	bool ssbs = false, kthread = tsk->flags & PF_KTHREAD;
> +	bool ssbs = false, kthread = tsk->flags & (PF_KTHREAD | PF_IO_WORKER);

Hmm, the other two uses of PF_KTHREAD in arch/arm64 also look pretty
suspect in light of this proposal. Should we also update
ssbs_thread_switch() and access_ok()? If not, then a comment would be
handy to say why PF_KTHREAD is sufficient there.

Will



More information about the linux-arm-kernel mailing list