blob: 8c8ecb1776595dfb1345d544fa0007f16b10ecd7 [file] [log] [blame]
Stephen Smalley61c80d52012-11-16 09:06:47 -05001# bluetooth subsystem
2type bluetooth, domain;
3app_domain(bluetooth)
Stephen Smalley85708ec2014-02-24 10:48:03 -05004net_domain(bluetooth)
Stephen Smalleyd7fd22e2013-10-22 12:56:32 -04005
6# Data file accesses.
7allow bluetooth bluetooth_data_file:dir create_dir_perms;
8allow bluetooth bluetooth_data_file:notdevfile_class_set create_file_perms;
9
Stephen Smalley09f6a992014-01-13 09:14:15 -050010# Socket creation under /data/misc/bluedroid.
11type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket;
12allow bluetooth bluetooth_socket:sock_file create_file_perms;
13
Stephen Smalleyd7fd22e2013-10-22 12:56:32 -040014# bluetooth factory file accesses.
15r_dir_file(bluetooth, bluetooth_efs_file)
16
17# Device accesses.
Stephen Smalleyb3c48b62013-10-23 13:50:19 -040018allow bluetooth { tun_device uhid_device hci_attach_dev }:chr_file rw_file_perms;
Stephen Smalleyd7fd22e2013-10-22 12:56:32 -040019
20# Other domains that can create and use bluetooth sockets.
21# SELinux does not presently define a specific socket class for
22# bluetooth sockets, nor does it distinguish among the bluetooth protocols.
Stephen Smalley16011322014-02-24 15:06:11 -050023# TODO: This should no longer be needed with bluedroid for bluetooth
24# but may be getting used for other non-bluetooth sockets that has no
25# specific class defined. Consider taking to specific domains.
Nick Kralevich46a640d2016-05-05 13:37:55 -070026allow { bluetoothdomain -untrusted_app -isolated_app -shell } self:socket create_socket_perms;
27neverallow { untrusted_app isolated_app shell } { untrusted_app isolated_app shell }:socket *;
Stephen Smalleyd7fd22e2013-10-22 12:56:32 -040028
29# sysfs access.
30allow bluetooth sysfs_bluetooth_writable:file rw_file_perms;
31allow bluetooth self:capability net_admin;
Sharvil Nanavati77eb3522014-06-29 10:45:03 -070032allow bluetooth self:capability2 wake_alarm;
Stephen Smalleyd7fd22e2013-10-22 12:56:32 -040033
34# Allow clients to use a socket provided by the bluetooth app.
Stephen Smalley16011322014-02-24 15:06:11 -050035# TODO: See if this is still required under bluedroid.
Sérgio Faria536ddba2014-06-29 13:11:27 +010036allow bluetoothdomain bluetooth:unix_stream_socket { getopt setopt getattr read write ioctl shutdown };
Stephen Smalleyd7fd22e2013-10-22 12:56:32 -040037
38# tethering
Stephen Smalley16011322014-02-24 15:06:11 -050039allow bluetooth self:tun_socket create_socket_perms;
Stephen Smalleyd7fd22e2013-10-22 12:56:32 -040040allow bluetooth efs_file:dir search;
41
Stephen Smalleyd7fd22e2013-10-22 12:56:32 -040042# proc access.
43allow bluetooth proc_bluetooth_writable:file rw_file_perms;
44
Nick Kralevich5b38c472013-10-29 12:45:10 -070045# Allow write access to bluetooth specific properties
William Roberts2f5a6a92015-05-04 18:22:45 -070046set_prop(bluetooth, bluetooth_prop)
47set_prop(bluetooth, pan_result_prop)
48set_prop(bluetooth, ctl_dhcp_pan_prop)
Nick Kralevich5b38c472013-10-29 12:45:10 -070049
dcashmancd825572014-12-11 16:01:27 -080050allow bluetooth bluetooth_service:service_manager find;
dcashman895a4f22015-02-11 13:25:57 -080051allow bluetooth mediaserver_service:service_manager find;
dcashmancd825572014-12-11 16:01:27 -080052allow bluetooth radio_service:service_manager find;
dcashman41d961a2015-02-12 09:50:20 -080053allow bluetooth surfaceflinger_service:service_manager find;
dcashmand12993f2015-04-02 16:50:08 -070054allow bluetooth app_api_service:service_manager find;
55allow bluetooth system_api_service:service_manager find;
Riley Spahnb8511e02014-07-07 13:56:27 -070056
Casper Bondefcdd3542015-03-19 10:56:26 +010057# Bluetooth Sim Access Profile Socket to the RIL
58unix_socket_connect(bluetooth, sap_uim, rild)
59
Nick Kralevich9819a6c2014-12-19 16:43:41 -080060# already open bugreport file descriptors may be shared with
61# the bluetooth process, from a file in
62# /data/data/com.android.shell/files/bugreports/bugreport-*.
63allow bluetooth shell_data_file:file read;
64
Stephen Smalleyd7fd22e2013-10-22 12:56:32 -040065###
66### Neverallow rules
67###
68### These are things that the bluetooth app should NEVER be able to do
69###
70
71# Superuser capabilities.
Sharvil Nanavati77eb3522014-06-29 10:45:03 -070072# bluetooth requires net_admin and wake_alarm.
Nick Kralevichbe660692014-07-04 10:12:13 -070073neverallow bluetooth self:capability ~net_admin;
Nick Kralevich33a779f2015-10-14 15:11:35 -070074neverallow bluetooth self:capability2 ~{ wake_alarm block_suspend };