]> git.hungrycats.org Git - linux/commit
proc: protect ptrace_may_access() with exec_update_lock (part 1)
authorJann Horn <jannh@google.com>
Mon, 18 May 2026 16:35:15 +0000 (18:35 +0200)
committerChristian Brauner <brauner@kernel.org>
Fri, 5 Jun 2026 08:00:55 +0000 (10:00 +0200)
commit6650527444dadc63d84aa939d14ecba4fadb2f69
tree0d0967408ddc7ad918c48319a1f3fcd660c1ab4c
parenta76640171b29fc91b9777a8e1bdc7e08db697275
proc: protect ptrace_may_access() with exec_update_lock (part 1)

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

Fixes: f83ce3e6b02d ("proc: avoid information leaks to non-privileged processes")
Cc: stable@vger.kernel.org
Signed-off-by: Jann Horn <jannh@google.com>
Link: https://patch.msgid.link/20260518-procfs-lockfix-part1-v1-1-5c3d20e0ac33@google.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/proc/array.c
fs/proc/base.c
fs/proc/namespaces.c