Add sepolicies to allow hal_health_default to load BPFs.

Bug: 203462310
Test: Ensure that the BPF filter can be loaded
Change-Id: Ib507d4c1718dd56fb336501ed7598de7b44a687b
This commit is contained in:
Stephane Lee 2022-03-08 14:56:27 -08:00
parent b93f26fd89
commit 52862a32c1
4 changed files with 22 additions and 1 deletions

View file

@ -40,7 +40,17 @@ neverallow domain { fs_bpf fs_bpf_tethering }:file ~{ create map open read setat
neverallow { domain -bpfloader } *:bpf { map_create prog_load };
neverallow { domain -bpfloader -gpuservice -mediaprovider_app -netd -netutils_wrapper -network_stack -system_server } *:bpf prog_run;
neverallow {
domain
-bpfloader
-gpuservice
-hal_health_server
-mediaprovider_app
-netd
-netutils_wrapper
-network_stack
-system_server
} *:bpf prog_run;
neverallow { domain -bpfloader -gpuservice -lmkd -mediaprovider_app -netd -network_stack -system_server } *:bpf { map_read map_write };
neverallow { domain -bpfloader -init } bpfloader_exec:file { execute execute_no_trans };

View file

@ -2,3 +2,5 @@
type charger_vendor, charger_type, domain;
hal_server_domain(charger_vendor, hal_health)
typeattribute charger_vendor bpfdomain;

View file

@ -26,3 +26,9 @@ allow hal_health_server kmsg_device:chr_file { getattr w_file_perms };
# Allow to use timerfd to wake itself up periodically to send health info.
allow hal_health_server self:capability2 wake_alarm;
# Use bpf programs
allow hal_health_server fs_bpf:dir search;
allow hal_health_server fs_bpf_vendor:dir search;
allow hal_health_server fs_bpf_vendor:file read;
allow hal_health_server bpfloader:bpf prog_run;

View file

@ -1,5 +1,8 @@
# health info abstraction
type hal_health_default, domain;
typeattribute hal_health_default bpfdomain;
hal_server_domain(hal_health_default, hal_health)
type hal_health_default_exec, exec_type, vendor_file_type, file_type;