linux-stable/fs/proc
Aleksa Sarai 7e388d0f9c procfs: block chmod on /proc/thread-self/comm
commit ccf61486fe upstream.

Due to an oversight in commit 1b3044e39a ("procfs: fix pthread
cross-thread naming if !PR_DUMPABLE") in switching from REG to NOD,
chmod operations on /proc/thread-self/comm were no longer blocked as
they are on almost all other procfs files.

A very similar situation with /proc/self/environ was used to as a root
exploit a long time ago, but procfs has SB_I_NOEXEC so this is simply a
correctness issue.

Ref: https://lwn.net/Articles/191954/
Ref: 6d76fa58b0 ("Don't allow chmod() on the /proc/<pid>/ files")
Fixes: 1b3044e39a ("procfs: fix pthread cross-thread naming if !PR_DUMPABLE")
Cc: stable@vger.kernel.org # v4.7+
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Message-Id: <20230713141001.27046-1-cyphar@cyphar.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-09-23 10:47:00 +02:00
..
Kconfig
Makefile
array.c fs/proc/array.c: allow reporting eip/esp for all coredumping threads 2019-07-03 13:15:59 +02:00
base.c procfs: block chmod on /proc/thread-self/comm 2023-09-23 10:47:00 +02:00
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c
fd.h
generic.c
inode.c proc: Use new_inode not new_inode_pseudo 2020-06-20 10:25:04 +02:00
internal.h
interrupts.c
kcore.c
kmsg.c
loadavg.c
meminfo.c
namespaces.c
nommu.c
page.c fs/proc/page.c: don't access uninitialized memmaps in fs/proc/page.c 2019-10-29 09:17:37 +01:00
proc_net.c
proc_sysctl.c sysctl: add a new register_sysctl_init() interface 2023-02-06 07:46:33 +01:00
proc_tty.c
root.c
self.c proc: don't allow async path resolution of /proc/self components 2020-12-02 08:34:41 +01:00
softirqs.c
stat.c
task_mmu.c mm: hugetlb: proc: check for hugetlb shared PMD in /proc/PID/smaps 2023-02-22 12:46:03 +01:00
task_nommu.c
thread_self.c proc: Use new_inode not new_inode_pseudo 2020-06-20 10:25:04 +02:00
uptime.c
version.c
vmcore.c proc/vmcore: fix clearing user buffer by properly using clear_user() 2021-12-08 08:46:52 +01:00