blob: 0b001e281eed3093fd040962c9454fde0c147486 [file] [log] [blame]
Jeff Vander Stoepff1e0182017-04-13 07:51:36 -07001# bluetooth app
Alex Klyubin801b5ec2017-02-06 15:27:19 -08002
Alan Stokes81e4e872020-02-11 14:43:05 +00003typeattribute bluetooth coredomain, mlstrustedsubject;
Alex Klyubin801b5ec2017-02-06 15:27:19 -08004
5app_domain(bluetooth)
6net_domain(bluetooth)
7
dcashmancc39f632016-07-22 13:13:11 -07008# Socket creation under /data/misc/bluedroid.
9type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket;
dcashman2e00e632016-10-12 14:58:09 -070010
Alex Klyubin801b5ec2017-02-06 15:27:19 -080011# 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;
Jakub Pawlowski86f79452022-04-07 16:03:39 +020018allow bluetooth bluetooth_data_file:notdevfile_class_set { create_file_perms link };
Alex Klyubin801b5ec2017-02-06 15:27:19 -080019allow 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
Benjamin Gordon9b2e0cb2017-11-09 15:51:26 -070025allow bluetooth self:global_capability_class_set net_admin;
26allow bluetooth self:global_capability2_class_set wake_alarm;
Alex Klyubin801b5ec2017-02-06 15:27:19 -080027
28# tethering
29allow bluetooth self:packet_socket create_socket_perms_no_ioctl;
Benjamin Gordon9b2e0cb2017-11-09 15:51:26 -070030allow bluetooth self:global_capability_class_set { net_admin net_raw net_bind_service };
Alex Klyubin801b5ec2017-02-06 15:27:19 -080031allow bluetooth self:tun_socket create_socket_perms_no_ioctl;
32allow bluetooth tun_device:chr_file rw_file_perms;
Nick Kralevich049c03d2018-11-10 09:03:10 -080033allowxperm bluetooth tun_device:chr_file ioctl { TUNGETIFF TUNSETIFF };
Alex Klyubin801b5ec2017-02-06 15:27:19 -080034allow bluetooth efs_file:dir search;
35
Jack Hea61f7f62017-04-18 18:06:41 -070036# allow Bluetooth to access uhid device for HID profile
37allow bluetooth uhid_device:chr_file rw_file_perms;
38
Jason Macnaka9339802022-02-24 18:32:16 +000039allow bluetooth gpu_device:chr_file rw_file_perms;
40allow bluetooth gpu_device:dir r_dir_perms;
41
Alex Klyubin801b5ec2017-02-06 15:27:19 -080042# proc access.
43allow bluetooth proc_bluetooth_writable:file rw_file_perms;
44
wescande4b6a6aa2021-08-23 16:59:08 +020045# For Bluetooth to check what profile are available
46allow bluetooth proc_filesystems:file r_file_perms;
47get_prop(bluetooth, incremental_prop)
48
Rubin Xua2748582022-05-12 14:49:10 +010049# For Bluetooth to check security logging state
50get_prop(bluetooth, device_logging_prop)
51
Alex Klyubin801b5ec2017-02-06 15:27:19 -080052# Allow write access to bluetooth specific properties
Lee Shombert097f9792020-01-17 10:06:16 -080053set_prop(bluetooth, binder_cache_bluetooth_server_prop);
54neverallow { domain -bluetooth -init }
55 binder_cache_bluetooth_server_prop:property_service set;
Jaekyun Seok224921d2018-04-09 12:07:32 +090056set_prop(bluetooth, bluetooth_a2dp_offload_prop)
Cheney Nie55a74b2019-03-18 11:07:32 +080057set_prop(bluetooth, bluetooth_audio_hal_prop)
Alex Klyubin801b5ec2017-02-06 15:27:19 -080058set_prop(bluetooth, bluetooth_prop)
Jaekyun Seok224921d2018-04-09 12:07:32 +090059set_prop(bluetooth, exported_bluetooth_prop)
Alex Klyubin801b5ec2017-02-06 15:27:19 -080060set_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;
Alex Klyubin801b5ec2017-02-06 15:27:19 -080067allow bluetooth app_api_service:service_manager find;
68allow bluetooth system_api_service:service_manager find;
Remi NGUYEN VAN44fd8852019-01-13 15:41:48 +090069allow bluetooth network_stack_service:service_manager find;
Michael Sundf54a522020-10-14 00:31:01 +000070allow bluetooth system_suspend_control_service:service_manager find;
Josh Wu759b4ef2021-12-27 07:36:01 -080071allow bluetooth hal_audio_service:service_manager find;
Alex Klyubin801b5ec2017-02-06 15:27:19 -080072
Alex Klyubin801b5ec2017-02-06 15:27:19 -080073# 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
Philip Cuadra6eee6eb2017-03-23 10:03:49 -070078# Bluetooth audio needs RT scheduling to meet deadlines, allow sys_nice
Benjamin Gordon9b2e0cb2017-11-09 15:51:26 -070079allow bluetooth self:global_capability_class_set sys_nice;
Philip Cuadra6eee6eb2017-03-23 10:03:49 -070080
Alex Klyubin168435f2017-02-16 20:14:56 -080081hal_client_domain(bluetooth, hal_bluetooth)
Alex Klyubin9e6b24c2017-03-16 18:48:40 -070082hal_client_domain(bluetooth, hal_telephony)
Alex Klyubin801b5ec2017-02-06 15:27:19 -080083
Sunny Kapdibc0c88f2017-10-30 12:58:20 -070084# Bluetooth A2DP offload requires binding with audio HAL
85hal_client_domain(bluetooth, hal_audio)
86
Alex Klyubin801b5ec2017-02-06 15:27:19 -080087read_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.
Philip Cuadra6eee6eb2017-03-23 10:03:49 -070096# Bluetooth requires net_{admin,raw,bind_service} and wake_alarm and block_suspend and sys_nice.
Benjamin Gordon9b2e0cb2017-11-09 15:51:26 -070097neverallow 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 };