Skip to content
Snippets Groups Projects
  • William Roberts's avatar
    2f5a6a96
    Replace unix_socket_connect() and explicit property sets with macro · 2f5a6a96
    William Roberts authored
    
    A common source of mistakes when authoring sepolicy is properly
    setting up property sets. This is a 3 part step of:
    1. Allowing the unix domain connection to the init/property service
    2. Allowing write on the property_socket file
    3. Allowing the set on class property_service
    
    The macro unix_socket_connect() handled 1 and 2, but could be
    confusing for first time policy authors. 3 had to be explicitly
    added.
    
    To correct this, we introduce a new macros:
    set_prop(sourcedomain, targetprop)
    
    This macro handles steps 1, 2 and 3.
    
    No difference in sediff is expected.
    
    (cherrypicked from commit 625a3526)
    
    Change-Id: I630ba0178439c935d08062892990d43a3cc1239e
    Signed-off-by: default avatarWilliam Roberts <william.c.roberts@linux.intel.com>
    2f5a6a96
    History
    Replace unix_socket_connect() and explicit property sets with macro
    William Roberts authored
    
    A common source of mistakes when authoring sepolicy is properly
    setting up property sets. This is a 3 part step of:
    1. Allowing the unix domain connection to the init/property service
    2. Allowing write on the property_socket file
    3. Allowing the set on class property_service
    
    The macro unix_socket_connect() handled 1 and 2, but could be
    confusing for first time policy authors. 3 had to be explicitly
    added.
    
    To correct this, we introduce a new macros:
    set_prop(sourcedomain, targetprop)
    
    This macro handles steps 1, 2 and 3.
    
    No difference in sediff is expected.
    
    (cherrypicked from commit 625a3526)
    
    Change-Id: I630ba0178439c935d08062892990d43a3cc1239e
    Signed-off-by: default avatarWilliam Roberts <william.c.roberts@linux.intel.com>
nfc.te 965 B
# nfc subsystem
type nfc, domain;
app_domain(nfc)
net_domain(nfc)
binder_service(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;

allow nfc sysfs_nfc_power_writable:file rw_file_perms;
allow nfc sysfs:file write;

allow nfc drmserver_service:service_manager find;
allow nfc mediaserver_service:service_manager find;
allow nfc nfc_service:service_manager { add find };
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;