From 28fde2322f91a33aaf822150da620b61b1c61a31 Mon Sep 17 00:00:00 2001
From: Tao Bao <tbao@google.com>
Date: Wed, 6 Sep 2017 14:27:37 -0700
Subject: [PATCH] Allow init to relabelto to misc_block_device.

avc:  denied  { relabelto } for  pid=1 comm="init" name="misc" dev="tmpfs" ino=3855 scontext=u:r:init:s0 tcontext=u:object_r:misc_block_device:s0 tclass=lnk_file

If misc partition is used during early mount, it will carry a label of
tmpfs (instead of block_device), which will fail restorecon with the
above denial.

Bug: 65378733
Test: Build and flash a target that uses misc in early mount. No longer
      observe the above denial.
Change-Id: I44cd43dbd2a8a4f9f423ebc8ac0dd046b167ef72
---
 public/init.te | 1 +
 1 file changed, 1 insertion(+)

diff --git a/public/init.te b/public/init.te
index 1903cfd74..c05fc5509 100644
--- a/public/init.te
+++ b/public/init.te
@@ -37,6 +37,7 @@ allow init kernel:fd use;
 # restorecon for early mount device symlinks
 allow init tmpfs:lnk_file { getattr read relabelfrom };
 allow init system_block_device:{ blk_file lnk_file } relabelto;
+allow init misc_block_device:{ blk_file lnk_file } relabelto;
 
 # setrlimit
 allow init self:capability sys_resource;
-- 
GitLab