commit | 79d36513cc55a500c8e08b7960378a674c386946 | [log] [tgz] |
---|---|---|
author | Nick Kralevich <nnk@google.com> | Thu Nov 01 08:23:00 2018 -0700 |
committer | Nick Kralevich <nnk@google.com> | Thu Nov 01 08:23:00 2018 -0700 |
tree | 06b045a4dd3bac329505bf637841f3dea27da624 | |
parent | 33442f57e798303870018a4741ede6dc0c65188c [diff] |
sgdisk: add blk_file ioctls Add support for the HDIO_GETGEO and BLKGETSIZE ioctls when operating on /dev/block/vold/ block devices. HDIO_GETGEO is needed by the sgdisk code to get the number of heads on the disk drive, likely a side effect of the age of this code. https://android.googlesource.com/platform/external/gptfdisk/+/646af625ced09e5d81e07fe8c02c32017e3cbc07/diskio-unix.cc#193 Addresses the following denial: audit(0.0:1775): avc: denied { ioctl } for comm="sgdisk" path="/dev/block/vold/disk:8,96" dev="tmpfs" ino=10740855 ioctlcmd=0x301 scontext=u:r:sgdisk:s0 tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0 BLKGETSIZE is used to determine the size of the block device. Ideally code should not be using this ioctl, as it fails for devices >= 2T in size. Technically we don't need to grant this, as the sgdisk code will fall back to using BLKGETSIZE64 if BLKGETSIZE fails. https://android.googlesource.com/platform/external/gptfdisk/+/646af625ced09e5d81e07fe8c02c32017e3cbc07/diskio-unix.cc#430 Addresses the following denial: audit(0.0:1778): avc: denied { ioctl } for comm="sgdisk" path="/dev/block/vold/disk:8,96" dev="tmpfs" ino=10740855 ioctlcmd=0x1260 scontext=u:r:sgdisk:s0 tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0 Test: policy compiles. Change-Id: Iaa5274721e8a7d1741591570e9e5305723aad640