Home | History | Annotate | Download | only in sepolicy
      1 # bluetooth subsystem
      2 type bluetooth, domain, domain_deprecated;
      3 app_domain(bluetooth)
      4 net_domain(bluetooth)
      5 
      6 wakelock_use(bluetooth);
      7 
      8 # Data file accesses.
      9 allow bluetooth bluetooth_data_file:dir create_dir_perms;
     10 allow bluetooth bluetooth_data_file:notdevfile_class_set create_file_perms;
     11 
     12 # Socket creation under /data/misc/bluedroid.
     13 type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket;
     14 allow bluetooth bluetooth_socket:sock_file create_file_perms;
     15 
     16 # bluetooth factory file accesses.
     17 r_dir_file(bluetooth, bluetooth_efs_file)
     18 
     19 allow bluetooth { uhid_device hci_attach_dev }:chr_file rw_file_perms;
     20 
     21 # sysfs access.
     22 allow bluetooth sysfs_bluetooth_writable:file rw_file_perms;
     23 allow bluetooth self:capability net_admin;
     24 allow bluetooth self:capability2 wake_alarm;
     25 
     26 # tethering
     27 allow bluetooth self:packet_socket create_socket_perms;
     28 allow bluetooth self:capability { net_admin net_raw net_bind_service };
     29 allow bluetooth self:tun_socket create_socket_perms;
     30 allow bluetooth tun_device:chr_file rw_file_perms;
     31 allow bluetooth efs_file:dir search;
     32 
     33 # proc access.
     34 allow bluetooth proc_bluetooth_writable:file rw_file_perms;
     35 
     36 # Allow write access to bluetooth specific properties
     37 set_prop(bluetooth, bluetooth_prop)
     38 set_prop(bluetooth, pan_result_prop)
     39 
     40 allow bluetooth audioserver_service:service_manager find;
     41 allow bluetooth bluetooth_service:service_manager find;
     42 allow bluetooth drmserver_service:service_manager find;
     43 allow bluetooth mediaserver_service:service_manager find;
     44 allow bluetooth radio_service:service_manager find;
     45 allow bluetooth surfaceflinger_service:service_manager find;
     46 allow bluetooth app_api_service:service_manager find;
     47 allow bluetooth system_api_service:service_manager find;
     48 
     49 # Bluetooth Sim Access Profile Socket to the RIL
     50 unix_socket_connect(bluetooth, sap_uim, rild)
     51 
     52 # already open bugreport file descriptors may be shared with
     53 # the bluetooth process, from a file in
     54 # /data/data/com.android.shell/files/bugreports/bugreport-*.
     55 allow bluetooth shell_data_file:file read;
     56 
     57 # Access to /data/media.
     58 # This should be removed if sdcardfs is modified to alter the secontext for its
     59 # accesses to the underlying FS.
     60 allow bluetooth media_rw_data_file:dir create_dir_perms;
     61 allow bluetooth media_rw_data_file:file create_file_perms;
     62 
     63 ###
     64 ### Neverallow rules
     65 ###
     66 ### These are things that the bluetooth app should NEVER be able to do
     67 ###
     68 
     69 # Superuser capabilities.
     70 # bluetooth requires net_{admin,raw,bind_service} and wake_alarm and block_suspend.
     71 neverallow bluetooth self:capability ~{ net_admin net_raw net_bind_service };
     72 neverallow bluetooth self:capability2 ~{ wake_alarm block_suspend };
     73