Alex Klyubin | 801b5ec | 2017-02-06 15:27:19 -0800 | [diff] [blame] | 1 | # bluetooth subsystem |
| 2 | |
| 3 | typeattribute bluetooth domain_deprecated; |
| 4 | |
| 5 | app_domain(bluetooth) |
| 6 | net_domain(bluetooth) |
| 7 | |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 8 | # Socket creation under /data/misc/bluedroid. |
| 9 | type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket; |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 10 | |
Alex Klyubin | 801b5ec | 2017-02-06 15:27:19 -0800 | [diff] [blame] | 11 | # Allow access to net_admin ioctls |
| 12 | allowxperm bluetooth self:udp_socket ioctl priv_sock_ioctls; |
| 13 | |
| 14 | wakelock_use(bluetooth); |
| 15 | |
| 16 | # Data file accesses. |
| 17 | allow bluetooth bluetooth_data_file:dir create_dir_perms; |
| 18 | allow bluetooth bluetooth_data_file:notdevfile_class_set create_file_perms; |
| 19 | allow bluetooth bluetooth_logs_data_file:dir rw_dir_perms; |
| 20 | allow bluetooth bluetooth_logs_data_file:file create_file_perms; |
| 21 | |
| 22 | # Socket creation under /data/misc/bluedroid. |
| 23 | allow bluetooth bluetooth_socket:sock_file create_file_perms; |
| 24 | |
Alex Klyubin | 801b5ec | 2017-02-06 15:27:19 -0800 | [diff] [blame] | 25 | allow bluetooth self:capability net_admin; |
| 26 | allow bluetooth self:capability2 wake_alarm; |
| 27 | |
| 28 | # tethering |
| 29 | allow bluetooth self:packet_socket create_socket_perms_no_ioctl; |
| 30 | allow bluetooth self:capability { net_admin net_raw net_bind_service }; |
| 31 | allow bluetooth self:tun_socket create_socket_perms_no_ioctl; |
| 32 | allow bluetooth tun_device:chr_file rw_file_perms; |
| 33 | allow bluetooth efs_file:dir search; |
| 34 | |
| 35 | # proc access. |
| 36 | allow bluetooth proc_bluetooth_writable:file rw_file_perms; |
| 37 | |
| 38 | # Allow write access to bluetooth specific properties |
| 39 | set_prop(bluetooth, bluetooth_prop) |
| 40 | set_prop(bluetooth, pan_result_prop) |
| 41 | |
| 42 | allow bluetooth audioserver_service:service_manager find; |
| 43 | allow bluetooth bluetooth_service:service_manager find; |
| 44 | allow bluetooth drmserver_service:service_manager find; |
| 45 | allow bluetooth mediaserver_service:service_manager find; |
| 46 | allow bluetooth radio_service:service_manager find; |
| 47 | allow bluetooth surfaceflinger_service:service_manager find; |
| 48 | allow bluetooth app_api_service:service_manager find; |
| 49 | allow bluetooth system_api_service:service_manager find; |
| 50 | |
| 51 | # Bluetooth Sim Access Profile Socket to the RIL |
| 52 | unix_socket_connect(bluetooth, sap_uim, rild) |
| 53 | |
| 54 | # already open bugreport file descriptors may be shared with |
| 55 | # the bluetooth process, from a file in |
| 56 | # /data/data/com.android.shell/files/bugreports/bugreport-*. |
| 57 | allow bluetooth shell_data_file:file read; |
| 58 | |
Alex Klyubin | 168435f | 2017-02-16 20:14:56 -0800 | [diff] [blame] | 59 | hal_client_domain(bluetooth, hal_bluetooth) |
Alex Klyubin | 801b5ec | 2017-02-06 15:27:19 -0800 | [diff] [blame] | 60 | binder_call(bluetooth, hal_telephony) |
Alex Klyubin | 9e6b24c | 2017-03-16 18:48:40 -0700 | [diff] [blame] | 61 | hal_client_domain(bluetooth, hal_telephony) |
Alex Klyubin | 801b5ec | 2017-02-06 15:27:19 -0800 | [diff] [blame] | 62 | |
| 63 | read_runtime_log_tags(bluetooth) |
| 64 | |
| 65 | ### |
| 66 | ### Neverallow rules |
| 67 | ### |
| 68 | ### These are things that the bluetooth app should NEVER be able to do |
| 69 | ### |
| 70 | |
| 71 | # Superuser capabilities. |
| 72 | # bluetooth requires net_{admin,raw,bind_service} and wake_alarm and block_suspend. |
| 73 | neverallow bluetooth self:capability ~{ net_admin net_raw net_bind_service }; |
| 74 | neverallow bluetooth self:capability2 ~{ wake_alarm block_suspend }; |