blob: 453e8a4224625a4588ec53cc4663bc18e80596f0 [file] [log] [blame]
Alex Klyubinf5446eb2017-03-23 14:27:32 -07001typeattribute init coredomain;
2
dcashmancc39f632016-07-22 13:13:11 -07003tmpfs_domain(init)
4
5# Transitions to seclabel processes in init.rc
Sandeep Patil137a13d2016-12-15 12:36:45 -08006domain_trans(init, rootfs, healthd)
dcashmancc39f632016-07-22 13:13:11 -07007domain_trans(init, rootfs, slideshow)
Tao Baoecc7e8c2018-09-07 15:05:33 -07008domain_auto_trans(init, charger_exec, charger)
Jin Qian4de505b2017-05-02 13:45:08 -07009domain_auto_trans(init, e2fs_exec, e2fs)
Joel Fernandes147cf642018-11-29 13:07:40 -080010domain_auto_trans(init, bpfloader_exec, bpfloader)
11
dcashmancc39f632016-07-22 13:13:11 -070012recovery_only(`
Tao Baoecc7e8c2018-09-07 15:05:33 -070013 # Files in recovery image are labeled as rootfs.
Bowgo Tsai5846c792017-07-31 18:38:28 +080014 domain_trans(init, rootfs, adbd)
Tao Baoecc7e8c2018-09-07 15:05:33 -070015 domain_trans(init, rootfs, charger)
Jerry Zhang1d85efa2018-05-29 10:54:16 -070016 domain_trans(init, rootfs, fastbootd)
dcashmancc39f632016-07-22 13:13:11 -070017 domain_trans(init, rootfs, recovery)
Kiyoung Kim2c271aa2019-12-09 14:57:46 +090018 domain_trans(init, rootfs, linkerconfig)
dcashmancc39f632016-07-22 13:13:11 -070019')
20domain_trans(init, shell_exec, shell)
21domain_trans(init, init_exec, ueventd)
Tom Cherry621c24c2017-09-28 14:34:36 -070022domain_trans(init, init_exec, vendor_init)
Sandeep Patile41af202017-06-02 16:09:26 -070023domain_trans(init, { rootfs toolbox_exec }, modprobe)
dcashmancc39f632016-07-22 13:13:11 -070024userdebug_or_eng(`
Tom Cherry938ab052018-08-03 10:49:20 -070025 # case where logpersistd is actually logcat -f in logd context (nee: logcatd)
Mark Salyzynda62cb42016-08-10 11:10:02 -070026 domain_auto_trans(init, logcat_exec, logpersist)
Tom Cherry938ab052018-08-03 10:49:20 -070027
28 # allow init to execute services marked with seclabel u:r:su:s0 in userdebug/eng
29 allow init su:process transition;
30 dontaudit init su:process noatsecure;
31 allow init su:process { siginh rlimitinh };
dcashmancc39f632016-07-22 13:13:11 -070032')
Branden Archerd36b1d52018-11-27 15:47:12 -080033
Nikita Ioffe23ba9762019-12-09 21:21:55 +000034# Allow init to figure out name of dm-device from it's /dev/block/dm-XX path.
35# This is useful in case of remounting ext4 userdata into checkpointing mode,
36# since it potentially requires tearing down dm-devices (e.g. dm-bow, dm-crypto)
37# that userdata is mounted onto.
38allow init sysfs_dm:file read;
39
Branden Archerd36b1d52018-11-27 15:47:12 -080040# Allow the BoringSSL self test to request a reboot upon failure
41set_prop(init, powerctl_prop)
Nikita Ioffe7065e462019-11-14 12:59:15 +000042
43# Only init is allowed to set userspace reboot related properties.
Nikita Ioffe7065e462019-11-14 12:59:15 +000044set_prop(init, userspace_reboot_exported_prop)
Nikita Ioffe7065e462019-11-14 12:59:15 +000045neverallow { domain -init } userspace_reboot_exported_prop:property_service set;
Ryan Savitski52b3d312020-01-14 18:20:06 +000046
47# Second-stage init performs a test for whether the kernel has SELinux hooks
48# for the perf_event_open() syscall. This is done by testing for the syscall
49# outcomes corresponding to this policy.
50# TODO(b/137092007): this can be removed once the platform stops supporting
51# kernels that precede the perf_event_open hooks (Android common kernels 4.4
52# and 4.9).
53allow init self:perf_event { open cpu };
Alistair Delva178f0ac2020-06-05 10:15:30 -070054allow init self:global_capability2_class_set perfmon;
Ryan Savitski52b3d312020-01-14 18:20:06 +000055neverallow init self:perf_event { kernel tracepoint read write };
56dontaudit init self:perf_event { kernel tracepoint read write };
57
58# Only init is allowed to set the sysprop indicating whether perf_event_open()
59# SELinux hooks were detected.
60set_prop(init, init_perf_lsm_hooks_prop)
61neverallow { domain -init } init_perf_lsm_hooks_prop:property_service set;
Inseob Kim212e2b62020-07-14 02:10:37 +090062
63# Only init can write vts.native_server.on
64set_prop(init, vts_status_prop)
65neverallow { -init } vts_status_prop:property_service set;
Inseob Kim8c342472020-07-23 17:54:35 +090066
67# Only init can write normal ro.boot. properties
68neverallow { -init } bootloader_prop:property_service set;