blob: b88c01453e271837ee2cdec7a51f766cb04e551d [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
10allow zipfuse system_bootstrap_lib_file:dir r_dir_perms;
11allow zipfuse system_bootstrap_lib_file:file { execute read open getattr map };
12
Inseob Kime1389972021-07-19 07:48:34 +000013# allow basic rules to implement FUSE
14allow zipfuse fuse_device:chr_file rw_file_perms;
15allow zipfuse self:global_capability_class_set sys_admin;
16
17# allow access to /dev/vd* block device files and also access to the symlinks
18# /dev/block/by-name/*
19allow zipfuse block_device:dir r_dir_perms;
20allow zipfuse block_device:lnk_file r_file_perms;
21
22# /dev/block/by-name/microdroid-apk is mapped to /dev/block/dm-*
23allow zipfuse dm_device:blk_file r_file_perms;
24
25# allow mounting on /mnt/apk
26allow zipfuse tmpfs:dir mounton;
27
28# allow mounting with fscontext=u:object_r:zipfusefs:s0
29type zipfusefs, fs_type, contextmount_type;
30allow zipfuse fuse:filesystem relabelfrom;
31allow zipfuse zipfusefs:filesystem { mount relabelfrom relabelto };
32
33# allow mounting with context=u:object_r:system_file:s0 so that files provided
34# by zipfuse are treated the same as the other files in /system or /apex
35allow system_file zipfusefs:filesystem associate;
Inseob Kim2df19cb2021-11-25 11:25:44 +090036
37# allow zipfuse to log to the kernel
38allow zipfuse kmsg_device:chr_file w_file_perms;
39
Inseob Kim8565b962021-11-29 14:56:46 +090040# allow zipfuse to handle extra apks
41r_dir_file(zipfuse, extra_apk_file)
42allow zipfuse extra_apk_file:dir mounton;
43
Inseob Kim2df19cb2021-11-25 11:25:44 +090044# zipfuse is forked from microdroid_manager
45# TODO(inseob): remove this
46allow zipfuse microdroid_manager:fd use;
47
48# Only microdroid_manager can run zipfuse
49neverallow { domain -microdroid_manager } zipfuse:process { transition dyntransition };
Inseob Kim8565b962021-11-29 14:56:46 +090050
51# only zipfuse can mount on extra_apk_file
52neverallow { domain -zipfuse } extra_apk_file:dir mounton;