From 8d32223bdc3d7bc75e5075494f6e4b956fb46bc3 Mon Sep 17 00:00:00 2001
From: Yifan Hong <elsk@google.com>
Date: Tue, 13 Nov 2018 16:23:38 -0800
Subject: [PATCH] Allow BLKIOMIN and BLKALIGNOFF to super device in
 update_engine.

These ioctls are similar to BLKGETSIZE64; they return benign information
about the partition's alignment, and are used by liblp to optimally
align dynamic partition extents.

The system_block_device is included here because on retrofit devices,
the "super" partition is mapped to the system partition.

Test: manual OTA on retrofit device
Bug: 118506262
Change-Id: I3dd3c99d86d63f97bcd393cff374e27f5ed2da2e
---
 public/update_engine_common.te | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/public/update_engine_common.te b/public/update_engine_common.te
index ccc335206..078a41b14 100644
--- a/public/update_engine_common.te
+++ b/public/update_engine_common.te
@@ -64,3 +64,12 @@ allow update_engine_common dm_device:blk_file rw_file_perms;
 
 # read / write metadata on super device to resize partitions
 allow update_engine_common super_block_device:blk_file rw_file_perms;
+
+# ioctl on super device to get block device alignment and alignment offset
+allowxperm update_engine_common {
+    system_block_device
+    super_block_device
+}:blk_file ioctl { BLKIOMIN BLKALIGNOFF };
+
+# get physical block device to map logical partitions on device mapper
+allow update_engine_common block_device:dir r_dir_perms;
-- 
GitLab