xref: /aosp_15_r20/system/sepolicy/prebuilts/api/34.0/private/bluetooth.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1# bluetooth app
2
3typeattribute bluetooth coredomain, mlstrustedsubject;
4
5app_domain(bluetooth)
6net_domain(bluetooth)
7
8# Socket creation under /data/misc/bluedroid.
9type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket;
10
11# Allow access to net_admin ioctls
12allowxperm bluetooth self:udp_socket ioctl priv_sock_ioctls;
13
14wakelock_use(bluetooth);
15
16# Data file accesses.
17allow bluetooth bluetooth_data_file:dir create_dir_perms;
18allow bluetooth bluetooth_data_file:notdevfile_class_set { create_file_perms link };
19allow bluetooth bluetooth_logs_data_file:dir rw_dir_perms;
20allow bluetooth bluetooth_logs_data_file:file create_file_perms;
21
22# Socket creation under /data/misc/bluedroid.
23allow bluetooth bluetooth_socket:sock_file create_file_perms;
24
25allow bluetooth self:global_capability_class_set net_admin;
26allow bluetooth self:global_capability2_class_set wake_alarm;
27
28# tethering
29allow bluetooth self:packet_socket create_socket_perms_no_ioctl;
30allow bluetooth self:global_capability_class_set { net_admin net_raw net_bind_service };
31allow bluetooth self:tun_socket create_socket_perms_no_ioctl;
32allow bluetooth tun_device:chr_file rw_file_perms;
33allowxperm bluetooth tun_device:chr_file ioctl { TUNGETIFF TUNSETIFF };
34allow bluetooth efs_file:dir search;
35
36# allow Bluetooth to access uhid device for HID profile
37allow bluetooth uhid_device:chr_file rw_file_perms;
38
39allow bluetooth gpu_device:chr_file rw_file_perms;
40allow bluetooth gpu_device:dir r_dir_perms;
41
42# proc access.
43allow bluetooth proc_bluetooth_writable:file rw_file_perms;
44
45# For Bluetooth to check what profile are available
46allow bluetooth proc_filesystems:file r_file_perms;
47get_prop(bluetooth, incremental_prop)
48
49# For Bluetooth to check security logging state
50get_prop(bluetooth, device_logging_prop)
51
52# Allow write access to bluetooth specific properties
53set_prop(bluetooth, binder_cache_bluetooth_server_prop);
54neverallow { domain -bluetooth -init }
55    binder_cache_bluetooth_server_prop:property_service set;
56set_prop(bluetooth, bluetooth_a2dp_offload_prop)
57set_prop(bluetooth, bluetooth_audio_hal_prop)
58set_prop(bluetooth, bluetooth_prop)
59set_prop(bluetooth, exported_bluetooth_prop)
60set_prop(bluetooth, pan_result_prop)
61
62allow bluetooth audioserver_service:service_manager find;
63allow bluetooth bluetooth_service:service_manager find;
64allow bluetooth drmserver_service:service_manager find;
65allow bluetooth mediaserver_service:service_manager find;
66allow bluetooth radio_service:service_manager find;
67allow bluetooth app_api_service:service_manager find;
68allow bluetooth system_api_service:service_manager find;
69allow bluetooth network_stack_service:service_manager find;
70allow bluetooth system_suspend_control_service:service_manager find;
71allow bluetooth hal_audio_service:service_manager find;
72
73# already open bugreport file descriptors may be shared with
74# the bluetooth process, from a file in
75# /data/data/com.android.shell/files/bugreports/bugreport-*.
76allow bluetooth shell_data_file:file read;
77
78# Bluetooth audio needs RT scheduling to meet deadlines, allow sys_nice
79allow bluetooth self:global_capability_class_set sys_nice;
80
81hal_client_domain(bluetooth, hal_bluetooth)
82hal_client_domain(bluetooth, hal_telephony)
83
84# Bluetooth A2DP offload requires binding with audio HAL
85hal_client_domain(bluetooth, hal_audio)
86
87read_runtime_log_tags(bluetooth)
88
89###
90### Neverallow rules
91###
92### These are things that the bluetooth app should NEVER be able to do
93###
94
95# Superuser capabilities.
96# Bluetooth requires net_{admin,raw,bind_service} and wake_alarm and block_suspend and sys_nice.
97neverallow bluetooth self:global_capability_class_set ~{ net_admin net_raw net_bind_service sys_nice};
98neverallow bluetooth self:global_capability2_class_set ~{ wake_alarm block_suspend };
99