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
Please register or sign in to comment