From 579271906ae9d2c1c060f1acda228ecde1cdddf8 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@google.com>
Date: Tue, 20 Nov 2018 16:13:07 -0800
Subject: [PATCH] zram: allow zram writeback

This allows fs_mgr in init to build loopback device and its control.

Bug: 74582279
Change-Id: I039cd57d4638870a59dd38c952d3ab9b671be545
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
---
 public/init.te | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/public/init.te b/public/init.te
index 10a0c6810..72c9c4367 100644
--- a/public/init.te
+++ b/public/init.te
@@ -362,6 +362,17 @@ allow init {
   sysfs_zram
 }:file rw_file_perms;
 
+# allow init to create loop devices with /dev/loop-control
+allow init loop_control_device:chr_file rw_file_perms;
+allow init loop_device:blk_file rw_file_perms;
+allowxperm init loop_device:blk_file ioctl {
+  LOOP_SET_FD
+  LOOP_CLR_FD
+  LOOP_CTL_GET_FREE
+  LOOP_SET_BLOCK_SIZE
+  LOOP_SET_DIRECT_IO
+};
+
 # Allow init to write to vibrator/trigger
 allow init sysfs_vibrator:file w_file_perms;
 
-- 
GitLab