platform_system_sepolicy/gpsd.te
dcashman 17cfd3fce7 Keep pre-existing sysfs write permissions.
Commit: b144ebab48 added the sysfs_usb
type and granted the read perms globally, but did not add write
permissions for all domains that previously had them.  Add the ability
to write to sysfs_usb for all domains that had the ability to write to
those files previously (sysfs).

Address denials such as:
type=1400 audit(1904.070:4): avc:  denied  { write } for  pid=321 comm="ueventd" name="uevent" dev="sysfs" ino=1742 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_usb:s0 tclass=file permissive=0

Bug: 28417852
Change-Id: I4562ea73f2158ebefba74b58ca572f2176d1b849
2016-06-14 14:13:14 -07:00

32 lines
992 B
Text

# gpsd - GPS daemon
type gpsd, domain;
type gpsd_exec, exec_type, file_type;
init_daemon_domain(gpsd)
net_domain(gpsd)
allow gpsd gps_data_file:dir rw_dir_perms;
allow gpsd gps_data_file:notdevfile_class_set create_file_perms;
# Socket is created by the daemon, not by init, and under /data/gps,
# not under /dev/socket.
type_transition gpsd gps_data_file:sock_file gps_socket;
allow gpsd gps_socket:sock_file create_file_perms;
# XXX Label sysfs files with a specific type?
allow gpsd sysfs:file rw_file_perms;
# TODO: added to match above sysfs rule. Remove me?
allow gpsd sysfs_usb:file w_file_perms;
allow gpsd gps_device:chr_file rw_file_perms;
# Execute the shell or system commands.
allow gpsd shell_exec:file rx_file_perms;
allow gpsd system_file:file rx_file_perms;
allow gpsd toolbox_exec:file rx_file_perms;
###
### neverallow
###
# gpsd can never have capabilities other than block_suspend
neverallow gpsd self:capability *;
neverallow gpsd self:capability2 ~block_suspend;