2017-09-28 23:34:36 +02:00
|
|
|
# vendor_init is its own domain.
|
|
|
|
type vendor_init, domain, mlstrustedsubject;
|
|
|
|
|
|
|
|
# Communication to the main init process
|
|
|
|
allow vendor_init init:unix_stream_socket { read write };
|
|
|
|
|
2018-02-09 20:31:56 +01:00
|
|
|
# Vendor init shouldn't communicate with any vendor process, nor most system processes.
|
|
|
|
neverallow_establish_socket_comms(vendor_init, { domain -init -logd -su -vendor_init });
|
|
|
|
|
2017-09-28 23:34:36 +02:00
|
|
|
# Logging to kmsg
|
|
|
|
allow vendor_init kmsg_device:chr_file { open write };
|
|
|
|
|
|
|
|
# Mount on /dev/usb-ffs/adb.
|
|
|
|
allow vendor_init device:dir mounton;
|
|
|
|
|
|
|
|
# Create and remove symlinks in /.
|
|
|
|
allow vendor_init rootfs:lnk_file { create unlink };
|
|
|
|
|
|
|
|
# Create cgroups mount points in tmpfs and mount cgroups on them.
|
|
|
|
allow vendor_init cgroup:dir create_dir_perms;
|
|
|
|
|
|
|
|
# /config
|
|
|
|
allow vendor_init configfs:dir mounton;
|
|
|
|
allow vendor_init configfs:dir create_dir_perms;
|
|
|
|
allow vendor_init configfs:{ file lnk_file } create_file_perms;
|
|
|
|
|
|
|
|
# Create directories under /dev/cpuctl after chowning it to system.
|
2017-11-09 23:51:26 +01:00
|
|
|
allow vendor_init self:global_capability_class_set dac_override;
|
2017-09-28 23:34:36 +02:00
|
|
|
|
|
|
|
# mkdir, symlink, write, rm/rmdir, chown/chmod, restorecon/restorecon_recursive from init.rc files.
|
|
|
|
# chown/chmod require open+read+setattr required for open()+fchown/fchmod().
|
|
|
|
# system/core/init.rc requires at least cache_file and data_file_type.
|
|
|
|
# init.<board>.rc files often include device-specific types, so
|
|
|
|
# we just allow all file types except /system files here.
|
2017-11-09 23:51:26 +01:00
|
|
|
allow vendor_init self:global_capability_class_set { chown fowner fsetid };
|
2017-09-28 23:34:36 +02:00
|
|
|
|
2018-04-13 02:30:56 +02:00
|
|
|
# mkdir with FBE requires reading /data/unencrypted/{ref,mode}.
|
|
|
|
allow vendor_init unencrypted_data_file:dir search;
|
|
|
|
allow vendor_init unencrypted_data_file:file r_file_perms;
|
|
|
|
|
2018-04-20 21:50:00 +02:00
|
|
|
allow vendor_init system_data_file:dir getattr;
|
|
|
|
|
2017-09-28 23:34:36 +02:00
|
|
|
allow vendor_init {
|
|
|
|
file_type
|
2018-01-22 23:18:31 +01:00
|
|
|
-core_data_file_type
|
2017-09-28 23:34:36 +02:00
|
|
|
-exec_type
|
|
|
|
-system_file
|
|
|
|
-unlabeled
|
|
|
|
-vendor_file_type
|
2018-02-01 19:15:34 +01:00
|
|
|
-vold_metadata_file
|
2018-01-22 23:18:31 +01:00
|
|
|
}:dir { create search getattr open read setattr ioctl write add_name remove_name rmdir relabelfrom };
|
2017-09-28 23:34:36 +02:00
|
|
|
|
|
|
|
allow vendor_init {
|
|
|
|
file_type
|
2018-01-22 23:18:31 +01:00
|
|
|
-core_data_file_type
|
2017-09-28 23:34:36 +02:00
|
|
|
-exec_type
|
|
|
|
-runtime_event_log_tags_file
|
|
|
|
-system_file
|
|
|
|
-unlabeled
|
|
|
|
-vendor_file_type
|
2018-02-01 19:15:34 +01:00
|
|
|
-vold_metadata_file
|
2017-09-28 23:34:36 +02:00
|
|
|
}:file { create getattr open read write setattr relabelfrom unlink };
|
|
|
|
|
|
|
|
allow vendor_init {
|
|
|
|
file_type
|
2018-01-22 23:18:31 +01:00
|
|
|
-core_data_file_type
|
2017-09-28 23:34:36 +02:00
|
|
|
-exec_type
|
|
|
|
-system_file
|
|
|
|
-unlabeled
|
|
|
|
-vendor_file_type
|
2018-02-01 19:15:34 +01:00
|
|
|
-vold_metadata_file
|
2017-09-28 23:34:36 +02:00
|
|
|
}:{ sock_file fifo_file } { create getattr open read setattr relabelfrom unlink };
|
|
|
|
|
|
|
|
allow vendor_init {
|
|
|
|
file_type
|
2018-01-22 23:18:31 +01:00
|
|
|
-core_data_file_type
|
2017-09-28 23:34:36 +02:00
|
|
|
-exec_type
|
|
|
|
-system_file
|
|
|
|
-unlabeled
|
|
|
|
-vendor_file_type
|
2018-02-01 19:15:34 +01:00
|
|
|
-vold_metadata_file
|
2017-09-28 23:34:36 +02:00
|
|
|
}:lnk_file { create getattr setattr relabelfrom unlink };
|
|
|
|
|
|
|
|
allow vendor_init {
|
|
|
|
file_type
|
2018-01-22 23:18:31 +01:00
|
|
|
-core_data_file_type
|
|
|
|
-exec_type
|
2017-09-28 23:34:36 +02:00
|
|
|
-system_file
|
|
|
|
-vendor_file_type
|
2018-02-01 19:15:34 +01:00
|
|
|
-vold_metadata_file
|
2017-09-28 23:34:36 +02:00
|
|
|
}:dir_file_class_set relabelto;
|
|
|
|
|
|
|
|
allow vendor_init dev_type:dir create_dir_perms;
|
|
|
|
allow vendor_init dev_type:lnk_file create;
|
|
|
|
|
|
|
|
# Disable tracing by writing to /sys/kernel/debug/tracing/tracing_on
|
|
|
|
allow vendor_init debugfs_tracing:file w_file_perms;
|
|
|
|
|
|
|
|
# chown/chmod on pseudo files.
|
|
|
|
allow vendor_init {
|
|
|
|
fs_type
|
|
|
|
-contextmount_type
|
|
|
|
-sdcard_type
|
|
|
|
-rootfs
|
|
|
|
-proc_uid_time_in_state
|
2017-11-10 23:10:19 +01:00
|
|
|
-proc_uid_concurrent_active_time
|
|
|
|
-proc_uid_concurrent_policy_time
|
2017-09-28 23:34:36 +02:00
|
|
|
}:file { open read setattr };
|
|
|
|
|
|
|
|
allow vendor_init {
|
|
|
|
fs_type
|
|
|
|
-contextmount_type
|
|
|
|
-sdcard_type
|
|
|
|
-rootfs
|
|
|
|
-proc_uid_time_in_state
|
2017-11-10 23:10:19 +01:00
|
|
|
-proc_uid_concurrent_active_time
|
|
|
|
-proc_uid_concurrent_policy_time
|
2017-09-28 23:34:36 +02:00
|
|
|
}:dir { open read setattr search };
|
|
|
|
|
|
|
|
# chown/chmod on devices, e.g. /dev/ttyHS0
|
|
|
|
allow vendor_init {
|
|
|
|
dev_type
|
|
|
|
-kmem_device
|
|
|
|
-port_device
|
|
|
|
-lowpan_device
|
|
|
|
-hw_random_device
|
|
|
|
}:chr_file setattr;
|
|
|
|
|
|
|
|
allow vendor_init dev_type:blk_file getattr;
|
|
|
|
|
|
|
|
# Write to /proc/sys/net/ping_group_range and other /proc/sys/net files.
|
|
|
|
r_dir_file(vendor_init, proc_net)
|
|
|
|
allow vendor_init proc_net:file w_file_perms;
|
2017-11-09 23:51:26 +01:00
|
|
|
allow vendor_init self:global_capability_class_set net_admin;
|
2017-09-28 23:34:36 +02:00
|
|
|
|
|
|
|
# Write to /proc/sys/vm/page-cluster
|
|
|
|
allow vendor_init proc_page_cluster:file w_file_perms;
|
|
|
|
|
|
|
|
# Write to sysfs nodes.
|
|
|
|
allow vendor_init sysfs_type:dir r_dir_perms;
|
|
|
|
allow vendor_init sysfs_type:lnk_file read;
|
|
|
|
allow vendor_init { sysfs_type -sysfs_usermodehelper }:file rw_file_perms;
|
|
|
|
|
|
|
|
# setfscreatecon() for labeling directories and socket files.
|
|
|
|
allow vendor_init self:process { setfscreate };
|
|
|
|
|
|
|
|
r_dir_file(vendor_init, vendor_file_type)
|
|
|
|
|
|
|
|
# Vendor init can read properties
|
|
|
|
allow vendor_init serialno_prop:file { getattr open read };
|
|
|
|
|
|
|
|
# Vendor init can perform operations on trusted and security Extended Attributes
|
2017-11-09 23:51:26 +01:00
|
|
|
allow vendor_init self:global_capability_class_set sys_admin;
|
2017-10-19 09:54:49 +02:00
|
|
|
|
2018-04-11 23:56:47 +02:00
|
|
|
# Raw writes to misc block device
|
|
|
|
allow vendor_init misc_block_device:blk_file w_file_perms;
|
|
|
|
|
2018-01-20 00:21:42 +01:00
|
|
|
not_compatible_property(`
|
|
|
|
set_prop(vendor_init, {
|
|
|
|
property_type
|
|
|
|
-restorecon_prop
|
|
|
|
-netd_stable_secret_prop
|
|
|
|
-firstboot_prop
|
|
|
|
-pm_prop
|
|
|
|
-system_boot_reason_prop
|
|
|
|
-bootloader_boot_reason_prop
|
|
|
|
-last_boot_reason_prop
|
|
|
|
})
|
|
|
|
')
|
|
|
|
|
2018-04-09 05:07:32 +02:00
|
|
|
set_prop(vendor_init, bluetooth_a2dp_offload_prop)
|
2017-10-19 09:54:49 +02:00
|
|
|
set_prop(vendor_init, debug_prop)
|
2018-04-09 05:07:32 +02:00
|
|
|
set_prop(vendor_init, exported_bluetooth_prop)
|
2017-10-19 09:54:49 +02:00
|
|
|
set_prop(vendor_init, exported_config_prop)
|
|
|
|
set_prop(vendor_init, exported_dalvik_prop)
|
|
|
|
set_prop(vendor_init, exported_default_prop)
|
|
|
|
set_prop(vendor_init, exported_ffs_prop)
|
|
|
|
set_prop(vendor_init, exported_overlay_prop)
|
|
|
|
set_prop(vendor_init, exported_pm_prop)
|
|
|
|
set_prop(vendor_init, exported_radio_prop)
|
|
|
|
set_prop(vendor_init, exported_system_radio_prop)
|
2018-04-09 05:07:32 +02:00
|
|
|
set_prop(vendor_init, exported_wifi_prop)
|
2017-10-19 09:54:49 +02:00
|
|
|
set_prop(vendor_init, exported2_config_prop)
|
|
|
|
set_prop(vendor_init, exported2_system_prop)
|
|
|
|
set_prop(vendor_init, exported2_vold_prop)
|
|
|
|
set_prop(vendor_init, exported3_default_prop)
|
2018-03-27 06:41:47 +02:00
|
|
|
set_prop(vendor_init, exported3_radio_prop)
|
2017-10-19 09:54:49 +02:00
|
|
|
set_prop(vendor_init, logd_prop)
|
|
|
|
set_prop(vendor_init, log_tag_prop)
|
|
|
|
set_prop(vendor_init, log_prop)
|
|
|
|
set_prop(vendor_init, serialno_prop)
|
|
|
|
set_prop(vendor_init, vendor_default_prop)
|
|
|
|
set_prop(vendor_init, wifi_log_prop)
|
|
|
|
|
|
|
|
get_prop(vendor_init, exported2_radio_prop)
|
|
|
|
get_prop(vendor_init, exported3_system_prop)
|