2017-03-23 22:27:32 +01:00
|
|
|
typeattribute init coredomain;
|
|
|
|
|
2016-07-22 22:13:11 +02:00
|
|
|
tmpfs_domain(init)
|
|
|
|
|
|
|
|
# Transitions to seclabel processes in init.rc
|
2016-12-15 21:36:45 +01:00
|
|
|
domain_trans(init, rootfs, healthd)
|
2016-07-22 22:13:11 +02:00
|
|
|
domain_trans(init, rootfs, slideshow)
|
2018-09-08 00:05:33 +02:00
|
|
|
domain_auto_trans(init, charger_exec, charger)
|
2017-05-02 22:45:08 +02:00
|
|
|
domain_auto_trans(init, e2fs_exec, e2fs)
|
2018-11-29 22:07:40 +01:00
|
|
|
domain_auto_trans(init, bpfloader_exec, bpfloader)
|
|
|
|
|
2016-07-22 22:13:11 +02:00
|
|
|
recovery_only(`
|
2018-09-08 00:05:33 +02:00
|
|
|
# Files in recovery image are labeled as rootfs.
|
2017-07-31 12:38:28 +02:00
|
|
|
domain_trans(init, rootfs, adbd)
|
2018-09-08 00:05:33 +02:00
|
|
|
domain_trans(init, rootfs, charger)
|
2018-05-29 19:54:16 +02:00
|
|
|
domain_trans(init, rootfs, fastbootd)
|
2016-07-22 22:13:11 +02:00
|
|
|
domain_trans(init, rootfs, recovery)
|
2019-12-09 06:57:46 +01:00
|
|
|
domain_trans(init, rootfs, linkerconfig)
|
2016-07-22 22:13:11 +02:00
|
|
|
')
|
|
|
|
domain_trans(init, shell_exec, shell)
|
|
|
|
domain_trans(init, init_exec, ueventd)
|
2017-09-28 23:34:36 +02:00
|
|
|
domain_trans(init, init_exec, vendor_init)
|
2017-06-03 01:09:26 +02:00
|
|
|
domain_trans(init, { rootfs toolbox_exec }, modprobe)
|
2016-07-22 22:13:11 +02:00
|
|
|
userdebug_or_eng(`
|
2018-08-03 19:49:20 +02:00
|
|
|
# case where logpersistd is actually logcat -f in logd context (nee: logcatd)
|
2016-08-10 20:10:02 +02:00
|
|
|
domain_auto_trans(init, logcat_exec, logpersist)
|
2018-08-03 19:49:20 +02:00
|
|
|
|
|
|
|
# allow init to execute services marked with seclabel u:r:su:s0 in userdebug/eng
|
|
|
|
allow init su:process transition;
|
|
|
|
dontaudit init su:process noatsecure;
|
|
|
|
allow init su:process { siginh rlimitinh };
|
2016-07-22 22:13:11 +02:00
|
|
|
')
|
2018-11-28 00:47:12 +01:00
|
|
|
|
2019-12-09 22:21:55 +01:00
|
|
|
# Allow init to figure out name of dm-device from it's /dev/block/dm-XX path.
|
|
|
|
# This is useful in case of remounting ext4 userdata into checkpointing mode,
|
|
|
|
# since it potentially requires tearing down dm-devices (e.g. dm-bow, dm-crypto)
|
|
|
|
# that userdata is mounted onto.
|
|
|
|
allow init sysfs_dm:file read;
|
|
|
|
|
2018-11-28 00:47:12 +01:00
|
|
|
# Allow the BoringSSL self test to request a reboot upon failure
|
|
|
|
set_prop(init, powerctl_prop)
|
2019-11-14 13:59:15 +01:00
|
|
|
|
|
|
|
# Only init is allowed to set userspace reboot related properties.
|
|
|
|
set_prop(init, userspace_reboot_exported_prop)
|
|
|
|
neverallow { domain -init } userspace_reboot_exported_prop:property_service set;
|
2020-01-14 19:20:06 +01:00
|
|
|
|
|
|
|
# Second-stage init performs a test for whether the kernel has SELinux hooks
|
|
|
|
# for the perf_event_open() syscall. This is done by testing for the syscall
|
|
|
|
# outcomes corresponding to this policy.
|
|
|
|
# TODO(b/137092007): this can be removed once the platform stops supporting
|
|
|
|
# kernels that precede the perf_event_open hooks (Android common kernels 4.4
|
|
|
|
# and 4.9).
|
|
|
|
allow init self:perf_event { open cpu };
|
2020-06-05 19:15:30 +02:00
|
|
|
allow init self:global_capability2_class_set perfmon;
|
2020-01-14 19:20:06 +01:00
|
|
|
neverallow init self:perf_event { kernel tracepoint read write };
|
|
|
|
dontaudit init self:perf_event { kernel tracepoint read write };
|
|
|
|
|
2020-10-30 08:12:22 +01:00
|
|
|
# Allow init to communicate with snapuserd to transition Virtual A/B devices
|
|
|
|
# from the first-stage daemon to the second-stage.
|
|
|
|
allow init snapuserd_socket:sock_file write;
|
|
|
|
allow init snapuserd:unix_stream_socket connectto;
|
|
|
|
# Allow for libsnapshot's use of flock() on /metadata/ota.
|
|
|
|
allow init ota_metadata_file:dir lock;
|
|
|
|
|
2020-01-14 19:20:06 +01:00
|
|
|
# Only init is allowed to set the sysprop indicating whether perf_event_open()
|
|
|
|
# SELinux hooks were detected.
|
|
|
|
set_prop(init, init_perf_lsm_hooks_prop)
|
|
|
|
neverallow { domain -init } init_perf_lsm_hooks_prop:property_service set;
|
2020-07-13 19:10:37 +02:00
|
|
|
|
|
|
|
# Only init can write vts.native_server.on
|
|
|
|
set_prop(init, vts_status_prop)
|
|
|
|
neverallow { -init } vts_status_prop:property_service set;
|
2020-07-23 10:54:35 +02:00
|
|
|
|
|
|
|
# Only init can write normal ro.boot. properties
|
|
|
|
neverallow { -init } bootloader_prop:property_service set;
|
2020-07-24 17:34:56 +02:00
|
|
|
|
|
|
|
# Only init can write hal.instrumentation.enable
|
|
|
|
neverallow { -init } hal_instrumentation_prop:property_service set;
|
|
|
|
|
|
|
|
# Only init can write ro.property_service.version
|
|
|
|
neverallow { -init } property_service_version_prop:property_service set;
|