platform_system_sepolicy/public/postinstall.te
Yifan Hong 1817cbde14 Allow to execute postinstall in adb sideload
In recovery, everything is labeled rootfs, including
/system/bin/*. Allow postinstall to execute them in recovery.

Test: sideload
Bug: 116608795
Fixes: 119877813
Change-Id: I5682bdecd0df1cb9ff3bc968ea29449b0b8588f4
2018-11-21 16:23:45 -08:00

41 lines
1.5 KiB
Text

# Domain where the postinstall program runs during the update.
# Extend the permissions in this domain to allow this program to access other
# files needed by the specific device on your device's sepolicy directory.
type postinstall, domain;
# Allow postinstall to write to its stdout/stderr when redirected via pipes to
# update_engine.
allow postinstall update_engine_common:fd use;
allow postinstall update_engine_common:fifo_file rw_file_perms;
# Allow postinstall to read and execute directories and files in the same
# mounted location.
allow postinstall postinstall_file:file rx_file_perms;
allow postinstall postinstall_file:lnk_file r_file_perms;
allow postinstall postinstall_file:dir r_dir_perms;
# Allow postinstall to execute the shell or other system executables.
allow postinstall shell_exec:file rx_file_perms;
allow postinstall system_file:file rx_file_perms;
allow postinstall toolbox_exec:file rx_file_perms;
# Allow postinstall to execute shell in recovery.
recovery_only(`
allow postinstall rootfs:file rx_file_perms;
')
#
# For OTA dexopt.
#
# Allow postinstall scripts to talk to the system server.
binder_use(postinstall)
binder_call(postinstall, system_server)
# Need to talk to the otadexopt service.
allow postinstall otadexopt_service:service_manager find;
# No domain other than update_engine and recovery (via update_engine_sideload)
# should transition to postinstall, as it is only meant to run during the
# update.
neverallow { domain -update_engine -recovery } postinstall:process { transition dyntransition };