blob: 0cb6daf8dbbbe657d8176fda64e52735248adc2b [file] [log] [blame]
Inseob Kime1389972021-07-19 07:48:34 +00001# zipfuse is a FUSE daemon running in the microdroid. It mounts
2# /dev/block/by-name/microdroid-apk whose content is from an apk file on
3# /mnt/apk so that the entries in the apk file are seen as regular files. See
4# packages/modules/Virtualization/zipfuse.
5
6type zipfuse, domain, coredomain;
7type zipfuse_exec, exec_type, file_type, system_file_type;
8
Jooyung Han53c773a2021-09-09 18:21:47 +09009# zipfuse is using bootstrap bionic
Jiyong Park16c1ae32022-01-23 23:55:41 +090010use_bootstrap_libs(zipfuse)
Jooyung Han53c773a2021-09-09 18:21:47 +090011
Inseob Kime1389972021-07-19 07:48:34 +000012# allow basic rules to implement FUSE
13allow zipfuse fuse_device:chr_file rw_file_perms;
14allow zipfuse self:global_capability_class_set sys_admin;
15
16# allow access to /dev/vd* block device files and also access to the symlinks
17# /dev/block/by-name/*
18allow zipfuse block_device:dir r_dir_perms;
19allow zipfuse block_device:lnk_file r_file_perms;
20
21# /dev/block/by-name/microdroid-apk is mapped to /dev/block/dm-*
22allow zipfuse dm_device:blk_file r_file_perms;
23
24# allow mounting on /mnt/apk
25allow zipfuse tmpfs:dir mounton;
26
27# allow mounting with fscontext=u:object_r:zipfusefs:s0
28type zipfusefs, fs_type, contextmount_type;
29allow zipfuse fuse:filesystem relabelfrom;
30allow zipfuse zipfusefs:filesystem { mount relabelfrom relabelto };
31
32# allow mounting with context=u:object_r:system_file:s0 so that files provided
33# by zipfuse are treated the same as the other files in /system or /apex
34allow system_file zipfusefs:filesystem associate;
Inseob Kim2df19cb2021-11-25 11:25:44 +090035
36# allow zipfuse to log to the kernel
37allow zipfuse kmsg_device:chr_file w_file_perms;
38
Inseob Kime987dcf2022-11-21 15:23:47 +090039# allow zipfuse to write kmsg_debug (stdio_to_kmsg) inherited from microdroid_manager.
40allow zipfuse kmsg_debug_device:chr_file w_file_perms;
41
Inseob Kim8565b962021-11-29 14:56:46 +090042# allow zipfuse to handle extra apks
43r_dir_file(zipfuse, extra_apk_file)
44allow zipfuse extra_apk_file:dir mounton;
45
Inseob Kim2df19cb2021-11-25 11:25:44 +090046# zipfuse is forked from microdroid_manager
Inseob Kim2df19cb2021-11-25 11:25:44 +090047allow zipfuse microdroid_manager:fd use;
48
Alan Stokesfb9911a2022-10-07 16:34:17 +010049# allow signalling when the mount is ready
50set_prop(zipfuse, microdroid_manager_zipfuse_prop)
51
Inseob Kim2df19cb2021-11-25 11:25:44 +090052# Only microdroid_manager can run zipfuse
53neverallow { domain -microdroid_manager } zipfuse:process { transition dyntransition };
Inseob Kim8565b962021-11-29 14:56:46 +090054
55# only zipfuse can mount on extra_apk_file
56neverallow { domain -zipfuse } extra_apk_file:dir mounton;