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
|
|
|
typeattribute shell coredomain;
|
2021-07-19 09:48:34 +02:00
|
|
|
|
|
|
|
# Perform SELinux access checks, needed for CTS
|
|
|
|
selinux_check_access(shell)
|
|
|
|
selinux_check_context(shell)
|
|
|
|
|
|
|
|
# Allow shell to run adb shell cmd stats commands. Needed for CTS.
|
|
|
|
binder_call(shell, statsd);
|
|
|
|
|
|
|
|
# Connect to adbd and use a socket transferred from it.
|
|
|
|
# This is used for e.g. adb backup/restore.
|
|
|
|
allow shell adbd:unix_stream_socket connectto;
|
|
|
|
allow shell adbd:fd use;
|
|
|
|
allow shell adbd:unix_stream_socket { getattr getopt ioctl read write shutdown };
|
|
|
|
|
|
|
|
# filesystem test for insecure chr_file's is done
|
|
|
|
# via a host side test
|
|
|
|
allow shell dev_type:dir r_dir_perms;
|
|
|
|
allow shell dev_type:chr_file getattr;
|
|
|
|
|
|
|
|
# filesystem test for insucre blk_file's is done
|
|
|
|
# via hostside test
|
|
|
|
allow shell dev_type:blk_file getattr;
|
2021-08-05 04:05:16 +02:00
|
|
|
|
|
|
|
# Test tool automatically tries to access /sys/class/power_supply.
|
|
|
|
# Suppressing it as we don't need power_supply in microdroid.
|
|
|
|
dontaudit shell sysfs:dir r_dir_perms;
|
2021-09-17 12:31:45 +02:00
|
|
|
|
|
|
|
# Test tool tries to read various service status properties.
|
2022-05-02 18:47:11 +02:00
|
|
|
get_prop(shell, boot_status_prop)
|
2021-09-17 12:31:45 +02:00
|
|
|
get_prop(shell, init_service_status_prop)
|
|
|
|
get_prop(shell, init_service_status_private_prop)
|
|
|
|
|
|
|
|
set_prop(shell, log_tag_prop)
|