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
|
|
|
|
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)
|
2021-11-16 03:56:22 +01:00
|
|
|
domain_trans(init, rootfs, hal_health_server)
|
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)
|
2021-11-13 09:22:01 +01:00
|
|
|
domain_trans(init, rootfs, servicemanager)
|
2021-02-04 21:30:09 +01:00
|
|
|
domain_trans(init, rootfs, snapuserd)
|
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;
|
|
|
|
|
2021-07-29 23:53:51 +02:00
|
|
|
# Allow init to modify the properties of loop devices.
|
|
|
|
allow init sysfs_loop:dir r_dir_perms;
|
|
|
|
allow init sysfs_loop:file rw_file_perms;
|
|
|
|
|
2021-10-13 18:21:54 +02:00
|
|
|
# Allow init to examine the properties of block devices.
|
2021-10-13 19:56:57 +02:00
|
|
|
allow init sysfs_type:file { getattr read };
|
|
|
|
# Allow init get the attributes of block devices in /dev/block.
|
|
|
|
allow init dev_type:dir r_dir_perms;
|
|
|
|
allow init dev_type:blk_file getattr;
|
2021-10-13 18:21:54 +02:00
|
|
|
|
2021-02-11 03:45:35 +01:00
|
|
|
# Allow init to write to the drop_caches file.
|
|
|
|
allow init proc_drop_caches:file rw_file_perms;
|
|
|
|
|
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;
|
|
|
|
|
2021-04-12 14:44:43 +02:00
|
|
|
# Allow init to restore contexts of vd_device(/dev/block/vd[..]) when labeling
|
|
|
|
# /dev/block.
|
|
|
|
allow init vd_device:blk_file relabelto;
|
|
|
|
|
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)
|
2021-03-10 02:42:23 +01:00
|
|
|
neverallow { domain -init } vts_status_prop:property_service set;
|
2020-07-23 10:54:35 +02:00
|
|
|
|
|
|
|
# Only init can write normal ro.boot. properties
|
2021-03-10 02:42:23 +01:00
|
|
|
neverallow { domain -init } bootloader_prop:property_service set;
|
2020-07-24 17:34:56 +02:00
|
|
|
|
2021-10-01 21:11:36 +02:00
|
|
|
# Only init can write ro.boot.hypervisor properties
|
|
|
|
neverallow { domain -init } hypervisor_prop:property_service set;
|
|
|
|
|
2020-07-24 17:34:56 +02:00
|
|
|
# Only init can write hal.instrumentation.enable
|
2021-03-10 02:42:23 +01:00
|
|
|
neverallow { domain -init } hal_instrumentation_prop:property_service set;
|
2020-07-24 17:34:56 +02:00
|
|
|
|
|
|
|
# Only init can write ro.property_service.version
|
2021-03-10 02:42:23 +01:00
|
|
|
neverallow { domain -init } property_service_version_prop:property_service set;
|
2021-02-23 17:40:05 +01:00
|
|
|
|
|
|
|
# Only init can set keystore.boot_level
|
2021-03-10 02:42:23 +01:00
|
|
|
neverallow { domain -init } keystore_listen_prop:property_service set;
|
2021-03-02 16:46:50 +01:00
|
|
|
|
2022-02-02 06:15:44 +01:00
|
|
|
# Only init can set the ro.remote_provisioning.* props
|
|
|
|
neverallow { domain -init } remote_prov_prop:property_service set;
|
|
|
|
|
2021-03-02 16:46:50 +01:00
|
|
|
# Allow accessing /sys/kernel/tracing/instances/bootreceiver to set up tracing.
|
|
|
|
allow init debugfs_bootreceiver_tracing:file w_file_perms;
|
2021-03-29 19:19:12 +02:00
|
|
|
|
2021-11-05 04:47:29 +01:00
|
|
|
# Devices with kernels where CONFIG_HIST_TRIGGERS isn't enabled will
|
|
|
|
# attempt to write a non exisiting 'synthetic_events' file, when setting
|
|
|
|
# up synthetic events. This is a no-op in tracefs.
|
|
|
|
dontaudit init debugfs_tracing_debug:dir { write add_name };
|
|
|
|
|
2021-03-29 19:19:12 +02:00
|
|
|
# chown/chmod on devices.
|
|
|
|
allow init {
|
|
|
|
dev_type
|
|
|
|
-hw_random_device
|
|
|
|
-keychord_device
|
|
|
|
-kvm_device
|
|
|
|
-port_device
|
|
|
|
}:chr_file setattr;
|