toolbox: add sepolicy for vendor toybox

The vendor toybox MUST always be executed without transition and
non-vendor processes are not allowed to execute the binary.

Bug: 36463595
Test: Boot and test if system shell can run /vendor/bin/echo
      Result: requires 'su'

Change-Id: Ifb9aa61f247f91fb870b99d60ac7f849ee9c6adc
Signed-off-by: Sandeep Patil <sspatil@google.com>
(cherry picked from commit c112cd18e8999c0242a2560219033231a0e19898)
This commit is contained in:
Sandeep Patil 2017-04-12 15:19:12 -07:00
parent 0b9432023d
commit 4fe441fb5f
2 changed files with 13 additions and 0 deletions

View File

@ -265,6 +265,7 @@
# Vendor files
#
/(vendor|system/vendor)(/.*)? u:object_r:vendor_file:s0
/(vendor|system/vendor)/bin/toybox_vendor u:object_r:vendor_toolbox_exec:s0
/(vendor|system/vendor)/etc(/.*)? u:object_r:vendor_configs_file:s0
/(vendor|system/vendor)/lib(64)?/egl(/.*)? u:object_r:same_process_hal_file:s0

12
public/vendor_toolbox.te Normal file
View File

@ -0,0 +1,12 @@
# Toolbox installation for vendor binaries / scripts
# Non-vendor processes are not allowed to execute the binary
# and is always executed without transition.
type vendor_toolbox_exec, exec_type, vendor_file_type, file_type;
# Do not allow domains to transition to vendor toolbox
# or read, execute the vendor_toolbox file.
full_treble_only(`
# Do not allow non-vendor domains to transition
# to vendor toolbox
neverallow coredomain vendor_toolbox_exec:file { entrypoint execute execute_no_trans };
')