linux/drivers/block
Ilya Dryomov ea3d3bf856 rbd: require global CAP_SYS_ADMIN for mapping and unmapping
commit f44d04e696 upstream.

It turns out that currently we rely only on sysfs attribute
permissions:

  $ ll /sys/bus/rbd/{add*,remove*}
  --w------- 1 root root 4096 Sep  3 20:37 /sys/bus/rbd/add
  --w------- 1 root root 4096 Sep  3 20:37 /sys/bus/rbd/add_single_major
  --w------- 1 root root 4096 Sep  3 20:37 /sys/bus/rbd/remove
  --w------- 1 root root 4096 Sep  3 20:38 /sys/bus/rbd/remove_single_major

This means that images can be mapped and unmapped (i.e. block devices
can be created and deleted) by a UID 0 process even after it drops all
privileges or by any process with CAP_DAC_OVERRIDE in its user namespace
as long as UID 0 is mapped into that user namespace.

Be consistent with other virtual block devices (loop, nbd, dm, md, etc)
and require CAP_SYS_ADMIN in the initial user namespace for mapping and
unmapping, and also for dumping the configuration string and refreshing
the image header.

Cc: stable@vger.kernel.org
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-17 13:47:53 +02:00
..
aoe
drbd
mtip32xx
paride
rsxx
xen-blkback
zram Revert "zram: convert remaining CLASS_ATTR() to CLASS_ATTR_RO()" 2020-07-22 09:33:12 +02:00
Kconfig
Makefile
amiflop.c
ataflop.c
brd.c
cryptoloop.c
floppy.c
loop.c block: loop: set discard granularity and alignment for block device backed loop 2020-09-03 11:27:01 +02:00
loop.h
nbd.c nbd: restore default timeout when setting it to zero 2020-09-09 19:12:22 +02:00
null_blk.h
null_blk_main.c null_blk: fix passing of REQ_FUA flag in null_handle_rq 2020-09-03 11:26:55 +02:00
null_blk_zoned.c
pktcdvd.c
ps3disk.c
ps3vram.c
rbd.c rbd: require global CAP_SYS_ADMIN for mapping and unmapping 2020-09-17 13:47:53 +02:00
rbd_types.h
skd_main.c
skd_s1120.h
sunvdc.c
swim.c
swim3.c
swim_asm.S
sx8.c
umem.c
umem.h
virtio_blk.c block: virtio_blk: fix handling single range discard request 2020-09-03 11:26:54 +02:00
xen-blkfront.c
xsysace.c
z2ram.c