WSL2-Linux-Kernel/arch
Vincent Bernat d59577b6ff sk-filter: Add ability to lock a socket filter program
While a privileged program can open a raw socket, attach some
restrictive filter and drop its privileges (or send the socket to an
unprivileged program through some Unix socket), the filter can still
be removed or modified by the unprivileged program. This commit adds a
socket option to lock the filter (SO_LOCK_FILTER) preventing any
modification of a socket filter program.

This is similar to OpenBSD BIOCLOCK ioctl on bpf sockets, except even
root is not allowed change/drop the filter.

The state of the lock can be read with getsockopt(). No error is
triggered if the state is not changed. -EPERM is returned when a user
tries to remove the lock or to change/remove the filter while the lock
is active. The check is done directly in sk_attach_filter() and
sk_detach_filter() and does not affect only setsockopt() syscall.

Signed-off-by: Vincent Bernat <bernat@luffy.cx>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-01-17 03:21:25 -05:00
..
alpha sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
arm DeviceTree fixes for 3.8 2013-01-14 13:19:08 -08:00
arm64 arm64: dts: prevent *.dtb from always being rebuilt 2013-01-14 08:08:28 -06:00
avr32 sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
blackfin ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
c6x These are a few cleanups for asm-generic: 2012-12-21 16:39:08 -08:00
cris sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
frv sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
h8300 sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
hexagon Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-12-20 18:05:28 -08:00
ia64 sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
m32r sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
m68k ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
microblaze Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze 2013-01-07 07:39:32 -08:00
mips sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
mn10300 sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
openrisc ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
parisc sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
powerpc sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
s390 sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
score ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
sh ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
sparc sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
tile ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
um ethtool: fix drvinfo strings set in drivers 2013-01-06 21:06:31 -08:00
unicore32 ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
x86 Merge git://git.kernel.org/pub/scm/virt/kvm/kvm 2013-01-10 09:05:18 -08:00
xtensa sk-filter: Add ability to lock a socket filter program 2013-01-17 03:21:25 -05:00
.gitignore
Kconfig Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-12-20 18:05:28 -08:00