Skip to content
Snippets Groups Projects
  • Alex Klyubin's avatar
    Annotate most remaining HALs with _client/_server · 9e6b24c6
    Alex Klyubin authored
    This switches most remaining HALs to the _client/_server approach.
    To unblock efforts blocked on majority of HALs having to use this
    model, this change does not remove unnecessary rules from clients of
    these HALs. That work will be performed in follow-up commits. This
    commit only adds allow rules and thus does not break existing
    functionality.
    
    The HALs not yet on the _client/_server model after this commit are:
    * Allocator HAL, because it's non-trivial to declare all apps except
      isolated apps as clients of this HAL, which they are.
    * Boot HAL, because it's still on the non-attributized model and I'm
      waiting for update_engine folks to answer a couple of questions
      which will let me refactor the policy of this HAL.
    
    Test: mmm system/sepolicy
    Test: Device boots, no new denials
    Test: Device boots in recovery mode, no new denials
    Bug: 34170079
    Change-Id: I03e6bcec2fa02f14bdf17d11f7367b62c68a14b9
    9e6b24c6
healthd.te 1.84 KiB
# healthd - battery/charger monitoring service daemon
type healthd, domain;
type healthd_exec, exec_type, file_type;

# Write to /dev/kmsg
allow healthd kmsg_device:chr_file rw_file_perms;

# Read access to pseudo filesystems.
r_dir_file(healthd, sysfs_type)
r_dir_file(healthd, rootfs)
r_dir_file(healthd, cgroup)

# Read access to system files for passthrough HALs in
# /{system,vendor,odm}/lib[64]/hw/
r_dir_file(healthd, system_file)

allow healthd self:capability { sys_tty_config };
allow healthd self:capability sys_boot;

allow healthd self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;

wakelock_use(healthd)

binder_use(healthd)
binder_service(healthd)
binder_call(healthd, system_server)
binder_call(healthd, hwservicemanager)
binder_call(healthd, hal_health)
hal_client_domain(healthd, hal_health)

# 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;

r_dir_file(healthd, sysfs_type)

###
### 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;

add_service(healthd, batteryproperties_service)

# Healthd needs to tell init to continue the boot
# process when running in charger mode.
set_prop(healthd, system_prop)