8c11cc3db5
(and while we're at it make sure noone else creates subdirs) Resolves: avc: denied { create } for comm="bpfloader" name="tethering" scontext=u:r:bpfloader:s0 tcontext=u:object_r:fs_bpf:s0 tclass=dir Test: builds and boots with bpfloader changes Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I27a4e0793ed039feab84ac5658e36b68dcca2631
40 lines
1.6 KiB
Text
40 lines
1.6 KiB
Text
# bpf program loader
|
|
type bpfloader, domain;
|
|
type bpfloader_exec, system_file_type, exec_type, file_type;
|
|
typeattribute bpfloader coredomain;
|
|
|
|
# These permissions are required to pin ebpf maps & programs.
|
|
allow bpfloader fs_bpf:dir { create search write add_name };
|
|
allow bpfloader fs_bpf:file { create setattr read };
|
|
|
|
# Allow bpfloader to create bpf maps and programs.
|
|
allow bpfloader self:bpf { map_create map_read map_write prog_load prog_run };
|
|
|
|
allow bpfloader self:capability { chown sys_admin };
|
|
|
|
###
|
|
### Neverallow rules
|
|
###
|
|
|
|
# TODO: get rid of init & vendor_init
|
|
neverallow { domain -init -vendor_init } fs_bpf:dir setattr;
|
|
neverallow { domain -bpfloader } fs_bpf:dir { create write add_name };
|
|
neverallow domain fs_bpf:dir { reparent rename rmdir };
|
|
|
|
# TODO: get rid of init & vendor_init
|
|
neverallow { domain -bpfloader -init -vendor_init } fs_bpf:file setattr;
|
|
neverallow { domain -bpfloader } fs_bpf:file create;
|
|
neverallow domain fs_bpf:file { rename unlink };
|
|
|
|
neverallow { domain -bpfloader } *:bpf { map_create prog_load };
|
|
neverallow { domain -bpfloader -gpuservice -netd -netutils_wrapper -network_stack -system_server } *:bpf prog_run;
|
|
neverallow { domain -bpfloader -gpuservice -netd -network_stack -system_server } *:bpf { map_read map_write };
|
|
|
|
neverallow { domain -bpfloader -init } bpfloader_exec:file { execute execute_no_trans };
|
|
|
|
neverallow bpfloader domain:{ tcp_socket udp_socket rawip_socket } *;
|
|
|
|
# No domain should be allowed to ptrace bpfloader
|
|
neverallow { domain userdebug_or_eng(`-llkd') } bpfloader:process ptrace;
|
|
|
|
set_prop(bpfloader, bpf_progs_loaded_prop)
|