Skip to content
Snippets Groups Projects
  • dcashman's avatar
    Split general policy into public and private components. · cc39f637
    dcashman authored
    Divide policy into public and private components.  This is the first
    step in splitting the policy creation for platform and non-platform
    policies.  The policy in the public directory will be exported for use
    in non-platform policy creation.  Backwards compatibility with it will
    be achieved by converting the exported policy into attribute-based
    policy when included as part of the non-platform policy and a mapping
    file will be maintained to be included with the platform policy that
    maps exported attributes of previous versions to the current platform
    version.
    
    Eventually we would like to create a clear interface between the
    platform and non-platform device components so that the exported policy,
    and the need for attributes is minimal.  For now, almost all types and
    avrules are left in public.
    
    Test: Tested by building policy and running on device.
    
    Change-Id: Idef796c9ec169259787c3f9d8f423edf4ce27f8c
    cc39f637
wificond.te 1.76 KiB
# wificond
type wificond, domain;
type wificond_exec, exec_type, file_type;

binder_use(wificond)
binder_call(wificond, system_server)
binder_call(wificond, wpa)

hwbinder_use(wificond)
binder_call(wificond, wifi_hal_legacy)

allow wificond wificond_service:service_manager { add find };

# wificond writes firmware paths to this file.
# wificond also changes the owership of this file on startup.
allow wificond sysfs_wlan_fwpath:file { w_file_perms setattr };

set_prop(wificond, wifi_prop)
set_prop(wificond, ctl_default_prop)

# create sockets to set interfaces up and down
allow wificond self:udp_socket create_socket_perms;
# setting interface state up/down is a privileged ioctl
allowxperm wificond self:udp_socket ioctl { SIOCSIFFLAGS };
allow wificond self:capability { net_admin net_raw };
# allow wificond to speak to nl80211 in the kernel
allow wificond self:netlink_socket create_socket_perms_no_ioctl;
# newer kernels (e.g. 4.4 but not 4.1) have a new class for sockets
allow wificond self:netlink_generic_socket create_socket_perms_no_ioctl;

r_dir_file(wificond, proc_net)

# wificond writes out configuration files for wpa_supplicant/hostapd.
# wificond also reads pid files out of this directory
allow wificond wifi_data_file:dir rw_dir_perms;
allow wificond wifi_data_file:file create_file_perms;

# wificond drops root shortly after starting
# wificond changes the ownership of some files before dropping root
allow wificond self:capability { setuid setgid setpcap chown };

# wificond cleans up sockets created by wpa_supplicant and framework
allow wificond wpa_socket:dir rw_dir_perms;
allow wificond system_wpa_socket:sock_file unlink;
allow wificond wpa_socket:sock_file unlink;

# dumpstate support
allow wificond dumpstate:fd use;
allow wificond dumpstate:fifo_file write;