2017-03-23 22:27:32 +01:00
|
|
|
typeattribute postinstall coredomain;
|
2021-03-11 20:26:08 +01:00
|
|
|
type postinstall_exec, system_file_type, exec_type, file_type;
|
2016-07-22 22:13:11 +02:00
|
|
|
domain_auto_trans(postinstall, otapreopt_chroot_exec, otapreopt_chroot)
|
2021-03-11 20:26:08 +01:00
|
|
|
|
|
|
|
allow postinstall rootfs:dir r_dir_perms;
|
2024-03-01 00:12:32 +01:00
|
|
|
|
|
|
|
# Allow invoking `pm` shell commands.
|
|
|
|
allow postinstall package_service:service_manager find;
|
2024-03-27 09:18:41 +01:00
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
|
|
|
# Allow postinstall scripts to trigger f2fs garbage collection
|
|
|
|
allow postinstall sysfs_fs_f2fs:file rw_file_perms;
|
|
|
|
allow postinstall sysfs_fs_f2fs:dir r_dir_perms;
|
|
|
|
|
|
|
|
###
|
|
|
|
### Neverallow rules
|
|
|
|
###
|
|
|
|
|
|
|
|
# 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 };
|