2016-11-01 21:49:10 +01:00
|
|
|
# healthd - battery/charger monitoring service daemon
|
|
|
|
type healthd, domain;
|
|
|
|
type healthd_exec, exec_type, file_type;
|
2013-06-03 23:09:54 +02:00
|
|
|
|
Allow /dev/klog access, drop mknod and __null__ access
Allow vold, healthd, slideshow, and watchdogd access to /dev/kmsg.
These processes log to the kernel dmesg ring buffer, so they need
write access to that file.
Addresses the following denials:
avc: denied { write } for pid=134 comm="watchdogd" name="kmsg" dev="tmpfs" ino=9248 scontext=u:r:watchdogd:s0 tcontext=u:object_r:kmsg_device:s0 tclass=chr_file permissive=0
avc: denied { write } for pid=166 comm="healthd" name="kmsg" dev="tmpfs" ino=9248 scontext=u:r:healthd:s0 tcontext=u:object_r:kmsg_device:s0 tclass=chr_file permissive=0
avc: denied { write } for pid=180 comm="vold" name="kmsg" dev="tmpfs" ino=9248 scontext=u:r:vold:s0 tcontext=u:object_r:kmsg_device:s0 tclass=chr_file permissive=0
These denials were triggered by the change in
https://android-review.googlesource.com/151209 . Prior to that change,
any code which called klog_init would (unnecessarily) create the
device node themselves, rather than using the already existing device
node.
Drop special /dev/__null__ handling from watchdogd. As of
https://android-review.googlesource.com/148288 , watchdogd no longer
creates it's own /dev/null device, so it's unnecessary for us
to allow for it.
Drop mknod from healthd, slideshow, and watchdogd. healthd and slideshow
only needed mknod to create /dev/__kmsg__, which is now obsolete.
watchdogd only needed mknod to create /dev/__kmsg__ and /dev/__null__,
which again is now obsolete.
Bug: 21242418
Change-Id: If01c8001084575e7441253f0fa8b4179ae33f534
2015-06-06 16:42:37 +02:00
|
|
|
# Write to /dev/kmsg
|
|
|
|
allow healthd kmsg_device:chr_file rw_file_perms;
|
2013-06-03 23:09:54 +02:00
|
|
|
|
2016-01-27 20:19:34 +01:00
|
|
|
# Read access to pseudo filesystems.
|
2017-10-17 00:54:49 +02:00
|
|
|
allow healthd sysfs_type:dir search;
|
2016-09-10 01:27:17 +02:00
|
|
|
r_dir_file(healthd, rootfs)
|
2016-11-01 21:49:10 +01:00
|
|
|
r_dir_file(healthd, cgroup)
|
2016-01-27 20:19:34 +01:00
|
|
|
|
2016-11-09 04:08:37 +01:00
|
|
|
# Read access to system files for passthrough HALs in
|
|
|
|
# /{system,vendor,odm}/lib[64]/hw/
|
|
|
|
r_dir_file(healthd, system_file)
|
|
|
|
|
2017-11-09 23:51:26 +01:00
|
|
|
allow healthd self:global_capability_class_set { sys_tty_config };
|
|
|
|
allow healthd self:global_capability_class_set sys_boot;
|
2016-11-01 21:49:10 +01:00
|
|
|
|
2016-05-17 06:12:17 +02:00
|
|
|
allow healthd self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;
|
2016-11-01 21:49:10 +01:00
|
|
|
|
2016-12-15 21:36:45 +01:00
|
|
|
wakelock_use(healthd)
|
|
|
|
|
2013-11-04 15:53:46 +01:00
|
|
|
binder_use(healthd)
|
2013-12-14 07:19:45 +01:00
|
|
|
binder_service(healthd)
|
2013-11-04 15:53:46 +01:00
|
|
|
binder_call(healthd, system_server)
|
2017-03-17 02:48:40 +01:00
|
|
|
hal_client_domain(healthd, hal_health)
|
2014-01-28 01:15:00 +01:00
|
|
|
|
2017-10-17 00:54:49 +02:00
|
|
|
# Read/write to /sys/power/state
|
|
|
|
allow healthd sysfs_power:file rw_file_perms;
|
2016-12-15 21:36:45 +01:00
|
|
|
|
|
|
|
# TODO: added to match above sysfs rule. Remove me?
|
|
|
|
allow healthd sysfs_usb:file write;
|
|
|
|
|
2017-10-17 00:54:49 +02:00
|
|
|
r_dir_file(healthd, sysfs_batteryinfo)
|
2016-12-15 21:36:45 +01:00
|
|
|
|
|
|
|
###
|
|
|
|
### 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;
|
|
|
|
|
2017-01-19 22:23:52 +01:00
|
|
|
add_service(healthd, batteryproperties_service)
|
2014-07-07 22:56:27 +02:00
|
|
|
|
2016-12-15 21:36:45 +01:00
|
|
|
# Healthd needs to tell init to continue the boot
|
|
|
|
# process when running in charger mode.
|
|
|
|
set_prop(healthd, system_prop)
|