Re: [PATCH 1/2] proc: protect ptrace_may_access() with exec_update_lock (part 1)
From: Jann Horn
Date: Fri Jun 05 2026 - 10:48:38 EST
On Fri, Jun 5, 2026 at 4:36 PM Mark Brown <broonie@xxxxxxxxxx> wrote:
> On Mon, May 18, 2026 at 06:35:15PM +0200, Jann Horn wrote:
> > Fix the easy cases where procfs currently calls ptrace_may_access() without
> > exec_update_lock protection, where the fix is to simply add the extra lock
> > or use mm_access():
>
> > - do_task_stat(): grab exec_update_lock
> > - proc_pid_wchan(): grab exec_update_lock
> > - proc_map_files_lookup(): use mm_access() instead of get_task_mm()
> > - proc_map_files_readdir(): use mm_access() instead of get_task_mm()
> > - proc_ns_get_link(): grab exec_update_lock
> > - proc_ns_readlink(): grab exec_update_lock
>
> It seems that this patch is triggering a failure in the proc selftests
> read test:
>
> # selftests: proc: read
> [ 259.127414] ICMPv6: process `read' is using deprecated sysctl (syscall) net.ipv6.neigh.default.base_reachable_time - use net.ipv6.neigh.default.base_reachable_time_ms instead
> [ 259.158773] /proc/cgroups lists only v1 controllers, use cgroup.controllers of root cgroup for v2 info
> [ 259.177155] sysrq: HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) force-fb(v) show-blocked-tasks(w) replay-kernel-logs(R)
> # read: proc.h:49: xreaddir: Assertion `de || errno == 0' failed.
> # Aborted
> not ok 19 selftests: proc: read # exit=134
Thanks for the report!
Yup, https://lore.kernel.org/oe-lkp/202606021924.b6d8a0c2-lkp@xxxxxxxxx
reported this too, it should be fixed with
https://lore.kernel.org/all/20260604155806.1402880-1-jannh@xxxxxxxxxx/
, which has been squashed into the current version of the VFS tree.