• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# bpf program loader
2type bpfloader, domain;
3type bpfloader_exec, system_file_type, exec_type, file_type;
4typeattribute bpfloader coredomain;
5
6# These permission is required for pin bpf program for netd.
7allow bpfloader fs_bpf:dir  create_dir_perms;
8allow bpfloader fs_bpf:file create_file_perms;
9allow bpfloader devpts:chr_file { read write };
10
11# Allow bpfloader to create bpf maps and programs. The map_read and map_write permission is needed
12# for retrieving a pinned map when bpfloader do a run time restart.
13allow bpfloader self:bpf { prog_load prog_run map_read map_write map_create };
14
15allow bpfloader self:global_capability_class_set sys_admin;
16
17###
18### Neverallow rules
19###
20neverallow { domain -bpfloader } *:bpf { map_create prog_load };
21neverallow { domain -bpfloader -netd -netutils_wrapper } *:bpf prog_run;
22neverallow { domain -bpfloader -init } bpfloader_exec:file { execute execute_no_trans };
23neverallow bpfloader domain:{ tcp_socket udp_socket rawip_socket } *;
24# only system_server, netd and bpfloader can read/write the bpf maps
25neverallow { domain -system_server -netd -bpfloader} *:bpf { map_read map_write };
26
27# No domain should be allowed to ptrace bpfloader
28neverallow { domain userdebug_or_eng(`-llkd') } bpfloader:process ptrace;
29
30set_prop(bpfloader, bpf_progs_loaded_prop)
31