Re: [PATCH] proc: protect ptrace_may_access() with exec_update_lock (part 1)

Magnus Lindholm <[email protected]> Mon, 6 Jul 2026 20:00:23 +0200
Newsgroups dev.linux.lists.regressions,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <CA+=Fv5R=mUW_p_AFFr-588F_b1hB=7RhMbtODya-gby=_fjBgg@mail.gmail.com>
Hi Jann,

>
> and that is wrong because previously, the ptrace_may_access() check
> relied on "error" still being "error = -EACCES" from the
> initialization at the top of the function, but now it is 0 from
> down_read_killable(), so now a ptrace permission check failure causes
> us to return with 0 without actually having called nd_jump_link(),
> which I think means we end up staying in /proc/$pid/ns?
>
> Sigh, I will send a fix.


Thanks for looking into this. That explanation makes sense, and it matches
what I was seeing from strace: /proc/<pid>/ns/pid could be opened, but the
NS_* ioctls then failed with ENOTTY and strace disabled pidns translation.

I'll retest the strace pidns-translation tests once your fix is available.

Thanks,
Magnus