kernel_optimize_test/include
Alexey Dobriyan b202ac9c73 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>
2020-12-30 11:53:56 +01:00
..
acpi
asm-generic
clocksource
crypto
drm
dt-bindings
keys
kunit
kvm
linux proc: fix lookup in /proc/net subdirectories after setns(2) 2020-12-30 11:53:56 +01:00
math-emu
media media: v4l2-fwnode: v4l2_fwnode_endpoint_parse caller must init vep argument 2020-12-30 11:53:11 +01:00
memory
misc
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2020-12-10 14:29:30 -08:00
pcmcia
ras
rdma RDMA/uverbs: Fix incorrect variable type 2020-12-30 11:53:47 +01:00
scsi
soc net: mscc: ocelot: fix dropping of unknown IPv4 multicast on Seville 2020-12-05 15:41:34 -08:00
sound
target
trace
uapi crypto: af_alg - avoid undefined behavior accessing salg_name 2020-12-26 16:02:45 +01:00
vdso
video
xen xen: don't use page->lru for ZONE_DEVICE memory 2020-12-09 10:31:41 +01:00