xref: /aosp_15_r20/system/sepolicy/private/asan_extract.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Worker# type_transition must be private policy the domain_trans rules could stay
2*e4a36f41SAndroid Build Coastguard Worker# public, but conceptually should go with this
3*e4a36f41SAndroid Build Coastguard Worker# Technically not a daemon but we do want the transition from init domain to
4*e4a36f41SAndroid Build Coastguard Worker# asan_extract to occur.
5*e4a36f41SAndroid Build Coastguard Workerwith_asan(`
6*e4a36f41SAndroid Build Coastguard Worker  typeattribute asan_extract coredomain;
7*e4a36f41SAndroid Build Coastguard Worker  init_daemon_domain(asan_extract)
8*e4a36f41SAndroid Build Coastguard Worker
9*e4a36f41SAndroid Build Coastguard Worker  # We need to signal a reboot when done.
10*e4a36f41SAndroid Build Coastguard Worker  set_prop(asan_extract, powerctl_prop)
11*e4a36f41SAndroid Build Coastguard Worker
12*e4a36f41SAndroid Build Coastguard Worker  # Allow asan_extract to execute itself using #!/system/bin/sh
13*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract shell_exec:file rx_file_perms;
14*e4a36f41SAndroid Build Coastguard Worker
15*e4a36f41SAndroid Build Coastguard Worker  # We execute log, rm, gzip and tar.
16*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract toolbox_exec:file rx_file_perms;
17*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract system_file:file execute_no_trans;
18*e4a36f41SAndroid Build Coastguard Worker
19*e4a36f41SAndroid Build Coastguard Worker  # asan_extract deletes old /data/lib.
20*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract system_file:dir { open read remove_name rmdir write };
21*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract system_file:file unlink;
22*e4a36f41SAndroid Build Coastguard Worker
23*e4a36f41SAndroid Build Coastguard Worker  # asan_extract untars ASAN libraries into /data.
24*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract system_data_file:dir create_dir_perms ;
25*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract system_data_file:{ file lnk_file } create_file_perms ;
26*e4a36f41SAndroid Build Coastguard Worker
27*e4a36f41SAndroid Build Coastguard Worker  # Relabel the libraries with restorecon.
28*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract file_contexts_file:file r_file_perms;
29*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract system_data_file:{ dir file } relabelfrom;
30*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract system_file:dir { relabelto setattr };
31*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract system_file:file relabelto;
32*e4a36f41SAndroid Build Coastguard Worker
33*e4a36f41SAndroid Build Coastguard Worker  # Restorecon will actually already try to run with sanitized libraries (libpackagelistparser).
34*e4a36f41SAndroid Build Coastguard Worker  allow asan_extract system_data_file:file execute;
35*e4a36f41SAndroid Build Coastguard Worker')
36