linux-stable/fs/proc
Aleksa Sarai c63323119b 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:48:11 +02:00
..
array.c fs/proc/array.c: allow reporting eip/esp for all coredumping threads 2019-07-03 13:14:44 +02:00
base.c procfs: block chmod on /proc/thread-self/comm 2023-09-23 10:48:11 +02:00
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c
fd.h
generic.c proc: fix dentry/inode overinstantiating under /proc/${pid}/net 2022-06-14 16:59:25 +02:00
inode.c proc: Use new_inode not new_inode_pseudo 2020-06-22 09:05:06 +02:00
internal.h proc: fix lookup in /proc/net subdirectories after setns(2) 2021-01-12 20:10:17 +01:00
interrupts.c
Kconfig proc/kcore: add vmcoreinfo note to /proc/kcore 2018-08-22 10:52:46 -07:00
kcore.c x86/gart: Exclude GART aperture from kcore 2019-04-20 09:15:59 +02:00
kmsg.c
loadavg.c
Makefile
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:19:56 +01:00
proc_net.c proc: fix dentry/inode overinstantiating under /proc/${pid}/net 2022-06-14 16:59:25 +02:00
proc_sysctl.c sysctl: add a new register_sysctl_init() interface 2023-02-06 07:49:44 +01:00
proc_tty.c
root.c
self.c proc: don't allow async path resolution of /proc/self components 2020-12-02 08:48:09 +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:47:15 +01:00
task_nommu.c proc: use down_read_killable mmap_sem for /proc/pid/maps 2019-07-31 07:27:09 +02:00
thread_self.c proc: Use new_inode not new_inode_pseudo 2020-06-22 09:05:06 +02:00
uptime.c
util.c
version.c
vmcore.c proc/vmcore: fix clearing user buffer by properly using clear_user() 2021-12-01 09:27:39 +01:00