platform_system_sepolicy/public/charger.te
Tri Vo cb043a58b5 charger: read permissions to /sys/power/state
Fixes these denials:
avc:  denied  { read } for  pid=585 comm="charger" name="state"
dev="sysfs" ino=18844 scontext=u:r:charger:s0
tcontext=u:object_r:sysfs_power:s0 tclass=file permissive=1

avc:  denied  { open } for  pid=585 comm="charger"
path="/sys/power/state" dev="sysfs" ino=18844 scontext=u:r:charger:s0
tcontext=u:object_r:sysfs_power:s0 tclass=file permissive=1

Test: above denials not observed in charger mode.
Change-Id: I5660e63315fada7f24d6cfe2e0bd2b383b556670
2017-11-14 17:43:09 -08:00

40 lines
1.3 KiB
Text

# charger seclabel is specified in init.rc since
# it lives in the rootfs and has no unique file type.
type charger, domain;
# Write to /dev/kmsg
allow charger kmsg_device:chr_file rw_file_perms;
# Read access to pseudo filesystems.
r_dir_file(charger, sysfs_type)
r_dir_file(charger, rootfs)
r_dir_file(charger, cgroup)
allow charger self:capability { sys_tty_config };
allow charger self:capability sys_boot;
wakelock_use(charger)
allow charger self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;
# Read/write to /sys/power/state
allow charger sysfs_power:file rw_file_perms;
allow charger sysfs_batteryinfo:file r_file_perms;
# 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 charger pstorefs:dir r_dir_perms;
allow charger pstorefs:file r_file_perms;
allow charger graphics_device:dir r_dir_perms;
allow charger graphics_device:chr_file rw_file_perms;
allow charger input_device:dir r_dir_perms;
allow charger input_device:chr_file r_file_perms;
allow charger tty_device:chr_file rw_file_perms;
allow charger proc_sysrq:file rw_file_perms;
# charger needs to tell init to continue the boot
# process when running in charger mode.
set_prop(charger, system_prop)