android_system_sepolicy/healthd.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

52 lines
1.6 KiB
Plaintext

# healthd seclabel is specified in init.rc since
# it lives in the rootfs and has no unique file type.
type healthd, domain, domain_deprecated;
# Write to /dev/kmsg
allow healthd kmsg_device:chr_file rw_file_perms;
# Read access to pseudo filesystems.
r_dir_file(healthd, sysfs)
allow healthd self:capability { net_admin sys_tty_config };
wakelock_use(healthd)
allow healthd self:netlink_kobject_uevent_socket create_socket_perms;
binder_use(healthd)
binder_service(healthd)
binder_call(healthd, system_server)
# Write to state file.
# TODO: Split into a separate type?
allow healthd sysfs:file write;
# TODO: added to match above sysfs rule. Remove me?
allow healthd sysfs_usb:file write;
allow healthd sysfs_batteryinfo:file r_file_perms;
###
### healthd: charger mode
###
# Read /sys/fs/pstore/console-ramoops
# Don't worry about overly broad permissions for now, as there's
# only one file in /sys/fs/pstore
allow healthd pstorefs:dir r_dir_perms;
allow healthd pstorefs:file r_file_perms;
allow healthd graphics_device:dir r_dir_perms;
allow healthd graphics_device:chr_file rw_file_perms;
allow healthd input_device:dir r_dir_perms;
allow healthd input_device:chr_file r_file_perms;
allow healthd tty_device:chr_file rw_file_perms;
allow healthd ashmem_device:chr_file execute;
allow healthd self:process execmem;
allow healthd proc_sysrq:file rw_file_perms;
allow healthd self:capability sys_boot;
allow healthd batteryproperties_service:service_manager { add find };
# Healthd needs to tell init to continue the boot
# process when running in charger mode.
set_prop(healthd, system_prop)