Remove redundant sepolicy
We don't use MLS in Microdroid, so we don't need MLS rules, nor
mlstrusted[subject|object] labels. (We keep one MLS rule to satisfy
checkpolicy.)
A lot of attributes are unused in Microdroid, so we can remove their
declarations and any references to them. (That may not make the
compiled policy smaller, since hopefully they get optimised out
anyway, but it means there is less policy for humans to deal with.)
Remove labels that relate only to apps, which we don't have - MAC
permissions, run-as, seapp_contexts.
In passing, fix a comment snafu in both system & microdroid policy.
Bug: 223596375
Test: Run staged-apex-compile & compos_verify, no denials
Test: atest MicrodroidTests MicrodroidHostTestCases
Change-Id: Ifd3589945a2d8b4c0361e00eec5678795513fd8c
2022-03-09 17:41:06 +01:00
|
|
|
# Domain used for su processes, as well as for adbd and adb shell
|
|
|
|
# after performing an adb root command.
|
|
|
|
|
2017-04-20 20:40:24 +02:00
|
|
|
# All types must be defined regardless of build variant to ensure
|
|
|
|
# policy compilation succeeds with userdebug/user combination at boot
|
|
|
|
type su, domain;
|
|
|
|
|
2016-10-12 23:58:09 +02:00
|
|
|
# File types must be defined for file_contexts.
|
2018-09-27 19:21:37 +02:00
|
|
|
type su_exec, system_file_type, exec_type, file_type;
|
2016-10-12 23:58:09 +02:00
|
|
|
|
|
|
|
userdebug_or_eng(`
|
2017-04-20 20:40:24 +02:00
|
|
|
typeattribute su mlstrustedsubject;
|
2016-10-12 23:58:09 +02:00
|
|
|
|
|
|
|
# Add su to various domains
|
|
|
|
net_domain(su)
|
|
|
|
|
2017-04-07 02:29:49 +02:00
|
|
|
# grant su access to vndbinder
|
|
|
|
vndbinder_use(su)
|
|
|
|
|
2016-10-12 23:58:09 +02:00
|
|
|
dontaudit su self:capability_class_set *;
|
2021-04-13 17:19:39 +02:00
|
|
|
dontaudit su self:capability2 *;
|
2016-10-12 23:58:09 +02:00
|
|
|
dontaudit su kernel:security *;
|
2018-08-13 19:56:49 +02:00
|
|
|
dontaudit su { kernel file_type }:system *;
|
2016-10-12 23:58:09 +02:00
|
|
|
dontaudit su self:memprotect *;
|
2022-03-23 03:52:00 +01:00
|
|
|
dontaudit su domain:anon_inode *;
|
2018-11-16 11:48:03 +01:00
|
|
|
dontaudit su domain:{ process process2 } *;
|
2016-10-12 23:58:09 +02:00
|
|
|
dontaudit su domain:fd *;
|
|
|
|
dontaudit su domain:dir *;
|
|
|
|
dontaudit su domain:lnk_file *;
|
|
|
|
dontaudit su domain:{ fifo_file file } *;
|
|
|
|
dontaudit su domain:socket_class_set *;
|
|
|
|
dontaudit su domain:ipc_class_set *;
|
|
|
|
dontaudit su domain:key *;
|
|
|
|
dontaudit su fs_type:filesystem *;
|
|
|
|
dontaudit su {fs_type dev_type file_type}:dir_file_class_set *;
|
|
|
|
dontaudit su node_type:node *;
|
|
|
|
dontaudit su node_type:{ tcp_socket udp_socket rawip_socket } *;
|
|
|
|
dontaudit su netif_type:netif *;
|
|
|
|
dontaudit su port_type:socket_class_set *;
|
|
|
|
dontaudit su port_type:{ tcp_socket dccp_socket } *;
|
|
|
|
dontaudit su domain:peer *;
|
|
|
|
dontaudit su domain:binder *;
|
|
|
|
dontaudit su property_type:property_service *;
|
|
|
|
dontaudit su property_type:file *;
|
|
|
|
dontaudit su service_manager_type:service_manager *;
|
2017-04-07 02:29:49 +02:00
|
|
|
dontaudit su hwservice_manager_type:hwservice_manager *;
|
2017-04-14 22:50:34 +02:00
|
|
|
dontaudit su vndservice_manager_type:service_manager *;
|
2016-10-12 23:58:09 +02:00
|
|
|
dontaudit su servicemanager:service_manager list;
|
2017-04-08 01:14:43 +02:00
|
|
|
dontaudit su hwservicemanager:hwservice_manager list;
|
2017-04-14 22:50:34 +02:00
|
|
|
dontaudit su vndservicemanager:service_manager list;
|
2016-10-12 23:58:09 +02:00
|
|
|
dontaudit su keystore:keystore_key *;
|
2020-07-27 21:53:20 +02:00
|
|
|
dontaudit su keystore:keystore2 *;
|
2016-10-12 23:58:09 +02:00
|
|
|
dontaudit su domain:drmservice *;
|
|
|
|
dontaudit su unlabeled:filesystem *;
|
|
|
|
dontaudit su postinstall_file:filesystem *;
|
2018-08-13 19:56:49 +02:00
|
|
|
dontaudit su domain:bpf *;
|
2019-05-04 10:13:38 +02:00
|
|
|
dontaudit su unlabeled:vsock_socket *;
|
2020-01-10 20:02:43 +01:00
|
|
|
dontaudit su self:perf_event *;
|
2017-09-26 21:58:29 +02:00
|
|
|
|
|
|
|
# VTS tests run in the permissive su domain on debug builds, but the HALs
|
|
|
|
# being tested run in enforcing mode. Because hal_foo_server is enforcing
|
|
|
|
# su needs to be declared as hal_foo_client to grant hal_foo_server
|
|
|
|
# permission to interact with it.
|
|
|
|
typeattribute su halclientdomain;
|
|
|
|
typeattribute su hal_allocator_client;
|
2018-09-20 01:06:28 +02:00
|
|
|
typeattribute su hal_atrace_client;
|
2017-09-26 21:58:29 +02:00
|
|
|
typeattribute su hal_audio_client;
|
2018-01-10 17:11:46 +01:00
|
|
|
typeattribute su hal_authsecret_client;
|
2017-09-26 21:58:29 +02:00
|
|
|
typeattribute su hal_bluetooth_client;
|
|
|
|
typeattribute su hal_bootctl_client;
|
|
|
|
typeattribute su hal_camera_client;
|
|
|
|
typeattribute su hal_configstore_client;
|
2018-01-09 23:42:53 +01:00
|
|
|
typeattribute su hal_confirmationui_client;
|
2017-09-26 21:58:29 +02:00
|
|
|
typeattribute su hal_contexthub_client;
|
|
|
|
typeattribute su hal_drm_client;
|
|
|
|
typeattribute su hal_cas_client;
|
|
|
|
typeattribute su hal_dumpstate_client;
|
|
|
|
typeattribute su hal_fingerprint_client;
|
|
|
|
typeattribute su hal_gatekeeper_client;
|
|
|
|
typeattribute su hal_gnss_client;
|
|
|
|
typeattribute su hal_graphics_allocator_client;
|
|
|
|
typeattribute su hal_graphics_composer_client;
|
|
|
|
typeattribute su hal_health_client;
|
2018-01-17 21:27:06 +01:00
|
|
|
typeattribute su hal_input_classifier_client;
|
2017-09-26 21:58:29 +02:00
|
|
|
typeattribute su hal_ir_client;
|
|
|
|
typeattribute su hal_keymaster_client;
|
|
|
|
typeattribute su hal_light_client;
|
|
|
|
typeattribute su hal_memtrack_client;
|
|
|
|
typeattribute su hal_neuralnetworks_client;
|
|
|
|
typeattribute su hal_nfc_client;
|
|
|
|
typeattribute su hal_oemlock_client;
|
|
|
|
typeattribute su hal_power_client;
|
2019-12-04 01:55:43 +01:00
|
|
|
typeattribute su hal_rebootescrow_client;
|
2018-01-04 19:33:20 +01:00
|
|
|
typeattribute su hal_secure_element_client;
|
2017-09-26 21:58:29 +02:00
|
|
|
typeattribute su hal_sensors_client;
|
|
|
|
typeattribute su hal_telephony_client;
|
|
|
|
typeattribute su hal_tetheroffload_client;
|
|
|
|
typeattribute su hal_thermal_client;
|
|
|
|
typeattribute su hal_tv_cec_client;
|
2022-09-19 17:46:07 +02:00
|
|
|
typeattribute su hal_tv_hdmi_client;
|
|
|
|
typeattribute su hal_tv_hdmi_cec_client;
|
2017-09-26 21:58:29 +02:00
|
|
|
typeattribute su hal_tv_input_client;
|
2019-08-09 23:27:17 +02:00
|
|
|
typeattribute su hal_tv_tuner_client;
|
2017-09-26 21:58:29 +02:00
|
|
|
typeattribute su hal_usb_client;
|
|
|
|
typeattribute su hal_vibrator_client;
|
|
|
|
typeattribute su hal_vr_client;
|
|
|
|
typeattribute su hal_weaver_client;
|
|
|
|
typeattribute su hal_wifi_client;
|
2017-12-23 00:03:15 +01:00
|
|
|
typeattribute su hal_wifi_hostapd_client;
|
2017-09-26 21:58:29 +02:00
|
|
|
typeattribute su hal_wifi_supplicant_client;
|
2016-10-12 23:58:09 +02:00
|
|
|
')
|