1# HwBinder IPC from client to server, and callbacks
2binder_call(hal_drm_client, hal_drm_server)
3binder_call(hal_drm_server, hal_drm_client)
4
5add_hwservice(hal_drm_server, hal_drm_hwservice)
6allow hal_drm_client hal_drm_hwservice:hwservice_manager find;
7
8allow hal_drm hidl_memory_hwservice:hwservice_manager find;
9
10# Required by Widevine DRM (b/22990512)
11allow hal_drm self:process execmem;
12
13# Permit reading device's serial number from system properties
14get_prop(hal_drm, serialno_prop)
15
16# System file accesses
17allow hal_drm system_file:dir r_dir_perms;
18allow hal_drm system_file:file r_file_perms;
19allow hal_drm system_file:lnk_file r_file_perms;
20
21# Read files already opened under /data
22allow hal_drm system_data_file:dir { search getattr };
23allow hal_drm system_data_file:file { getattr read };
24allow hal_drm system_data_file:lnk_file r_file_perms;
25
26# Read access to pseudo filesystems
27r_dir_file(hal_drm, cgroup)
28allow hal_drm cgroup:dir { search write };
29allow hal_drm cgroup:file w_file_perms;
30
31# Allow access to ion memory allocation device
32allow hal_drm ion_device:chr_file rw_file_perms;
33allow hal_drm hal_graphics_allocator:fd use;
34
35# Allow access to fds allocated by mediaserver
36allow hal_drm mediaserver:fd use;
37
38# Allow access to app_data and media_data_files
39allow hal_drm media_data_file:dir create_dir_perms;
40allow hal_drm media_data_file:file create_file_perms;
41allow hal_drm media_data_file:file { getattr read };
42
43allow hal_drm sysfs:file r_file_perms;
44
45allow hal_drm tee_device:chr_file rw_file_perms;
46
47# only allow unprivileged socket ioctl commands
48allowxperm hal_drm self:{ rawip_socket tcp_socket udp_socket }
49  ioctl { unpriv_sock_ioctls unpriv_tty_ioctls };
50
51###
52### neverallow rules
53###
54
55# hal_drm should never execute any executable without a
56# domain transition
57neverallow hal_drm { file_type fs_type }:file execute_no_trans;
58
59# do not allow privileged socket ioctl commands
60neverallowxperm hal_drm domain:{ rawip_socket tcp_socket udp_socket } ioctl priv_sock_ioctls;
61