linux/fs/proc
Alexey Dobriyan 9ea03f6890 proc: fix lookup in /proc/net subdirectories after setns(2)
[ Upstream commit c6c75deda81344c3a95d1d1f606d5cee109e5d54 ]

Commit 1fde6f21d9 ("proc: fix /proc/net/* after setns(2)") only forced
revalidation of regular files under /proc/net/

However, /proc/net/ is unusual in the sense of /proc/net/foo handlers
take netns pointer from parent directory which is old netns.

Steps to reproduce:

	(void)open("/proc/net/sctp/snmp", O_RDONLY);
	unshare(CLONE_NEWNET);

	int fd = open("/proc/net/sctp/snmp", O_RDONLY);
	read(fd, &c, 1);

Read will read wrong data from original netns.

Patch forces lookup on every directory under /proc/net .

Link: https://lkml.kernel.org/r/20201205160916.GA109739@localhost.localdomain
Fixes: 1da4d377f9 ("proc: revalidate misc dentries")
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reported-by: "Rantala, Tommi T. (Nokia - FI/Espoo)" <tommi.t.rantala@nokia.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-01-12 20:16:10 +01:00
..
Kconfig
Makefile
array.c
base.c exec: Transform exec_update_mutex into a rw_semaphore 2021-01-09 13:44:55 +01:00
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c
fd.h
generic.c proc: fix lookup in /proc/net subdirectories after setns(2) 2021-01-12 20:16:10 +01:00
inode.c
internal.h proc: fix lookup in /proc/net subdirectories after setns(2) 2021-01-12 20:16:10 +01:00
interrupts.c
kcore.c
kmsg.c
loadavg.c
meminfo.c
namespaces.c
nommu.c
page.c
proc_net.c proc: fix lookup in /proc/net subdirectories after setns(2) 2021-01-12 20:16:10 +01:00
proc_sysctl.c
proc_tty.c
root.c
self.c proc: don't allow async path resolution of /proc/self components 2020-12-02 08:49:48 +01:00
softirqs.c
stat.c
task_mmu.c proc: use untagged_addr() for pagemap_read addresses 2020-12-16 10:56:58 +01:00
task_nommu.c
thread_self.c
uptime.c
util.c
version.c
vmcore.c