Re: [PATCH] mm/migrate: find_mm_struct: fix race between security checks and suid exec

From: Oleg Nesterov

Date: Wed May 27 2026 - 06:04:34 EST


On 05/26, Andrew Morton wrote:
>
> On Tue, 26 May 2026 16:42:11 +0200 Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> > The target task can execute a setuid binary between ptrace_may_access()
> > and get_task_mm(). Protect this critical section with exec_update_lock.
> >
> > I don't think cpuset_mems_allowed(task) should be called under
> > exec_update_lock, but this patch just tries to add the minimal fix.
> >
> > Perhaps we can later add a common helper which can be used by
> > find_mm_struct() and kernel_migrate_pages().
> >
>
> Do you think we should backport this into earlier kernels?

Probably not... The race is very unlikely and iiuc the impact is not
serious...

Up to maintainers.

Oleg.