Skip to content
Snippets Groups Projects
  • William Roberts's avatar
    te_macros: introduce add_service() macro · 606d2fd6
    William Roberts authored
    
    Introduce the add_service() macro which wraps up add/find
    permissions for the source domain with a neverallow preventing
    others from adding it. Only a particular domain should
    add a particular service.
    
    Use the add_service() macro to automatically add a neverallow
    that prevents other domains from adding the service.
    
    mediadrmserver was adding services labeled mediaserver_service.
    Drop the add permission as it should just need the find
    permission.
    
    Additionally, the macro adds the { add find } permission which
    causes some existing neverallow's to assert. Adjust those
    neverallow's so "self" can always find.
    
    Test: compile and run on hikey and emulator. No new denials were
    found, and all services, where applicable, seem to be running OK.
    
    Change-Id: Ibbd2a5304edd5f8b877bc86852b0694732be993c
    Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
    606d2fd6
nfc.te 1.17 KiB
# nfc subsystem
type nfc, domain;

net_domain(nfc)
binder_service(nfc)

# hwbinder access
hwbinder_use(nfc)

# Set NFC properties
set_prop(nfc, nfc_prop)

# NFC device access.
allow nfc nfc_device:chr_file rw_file_perms;

# Data file accesses.
allow nfc nfc_data_file:dir create_dir_perms;
allow nfc nfc_data_file:notdevfile_class_set create_file_perms;

# SoundPool loading and playback
allow nfc audioserver_service:service_manager find;
allow nfc drmserver_service:service_manager find;
allow nfc mediacodec_service:service_manager find;
allow nfc mediametrics_service:service_manager find;
allow nfc mediaextractor_service:service_manager find;
allow nfc mediaserver_service:service_manager find;

add_service(nfc, nfc_service)
allow nfc radio_service:service_manager find;
allow nfc surfaceflinger_service:service_manager find;
allow nfc app_api_service:service_manager find;
allow nfc system_api_service:service_manager find;

# already open bugreport file descriptors may be shared with
# the nfc process, from a file in
# /data/data/com.android.shell/files/bugreports/bugreport-*.
allow nfc shell_data_file:file read;

# allow NFC process to call into the NFC HAL
binder_call(nfc, hal_nfc)