blob: 3595ee426c67b0923bff62f5ba8a4024aa77fbae [file] [log] [blame]
Alex Klyubin5d30beb2017-02-07 10:05:07 -08001# surfaceflinger - display compositor service
2
Alex Klyubinf5446eb2017-03-23 14:27:32 -07003typeattribute surfaceflinger coredomain;
4
Alex Klyubin5d30beb2017-02-07 10:05:07 -08005type surfaceflinger_exec, exec_type, file_type;
dcashmancc39f632016-07-22 13:13:11 -07006init_daemon_domain(surfaceflinger)
Alex Klyubin5d30beb2017-02-07 10:05:07 -08007
8typeattribute surfaceflinger mlstrustedsubject;
Steven Morelande8ab0022017-05-16 17:43:52 -07009typeattribute surfaceflinger display_service_server;
Alex Klyubin5d30beb2017-02-07 10:05:07 -080010
11read_runtime_log_tags(surfaceflinger)
12
13# Perform HwBinder IPC.
Alex Klyubin9e6b24c2017-03-16 18:48:40 -070014hal_client_domain(surfaceflinger, hal_graphics_allocator)
Alex Klyubin9e6b24c2017-03-16 18:48:40 -070015hal_client_domain(surfaceflinger, hal_graphics_composer)
Alex Klyubin9e6b24c2017-03-16 18:48:40 -070016hal_client_domain(surfaceflinger, hal_configstore)
Alex Klyubin53656c12017-04-13 19:05:27 -070017allow surfaceflinger hal_configstore_ISurfaceFlingerConfigs:hwservice_manager find;
18allow surfaceflinger hidl_token_hwservice:hwservice_manager find;
Alex Klyubin5d30beb2017-02-07 10:05:07 -080019
20# Perform Binder IPC.
21binder_use(surfaceflinger)
22binder_call(surfaceflinger, binderservicedomain)
23binder_call(surfaceflinger, appdomain)
24binder_call(surfaceflinger, bootanim)
25binder_service(surfaceflinger)
26
27# Binder IPC to bu, presently runs in adbd domain.
28binder_call(surfaceflinger, adbd)
29
30# Read /proc/pid files for Binder clients.
31r_dir_file(surfaceflinger, binderservicedomain)
32r_dir_file(surfaceflinger, appdomain)
33
34# Access the GPU.
35allow surfaceflinger gpu_device:chr_file rw_file_perms;
36
37# Access /dev/graphics/fb0.
38allow surfaceflinger graphics_device:dir search;
39allow surfaceflinger graphics_device:chr_file rw_file_perms;
40
41# Access /dev/video1.
42allow surfaceflinger video_device:dir r_dir_perms;
43allow surfaceflinger video_device:chr_file rw_file_perms;
44
45# Create and use netlink kobject uevent sockets.
46allow surfaceflinger self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;
47
48# Set properties.
49set_prop(surfaceflinger, system_prop)
50set_prop(surfaceflinger, ctl_bootanim_prop)
51
52# Use open files supplied by an app.
53allow surfaceflinger appdomain:fd use;
54allow surfaceflinger app_data_file:file { read write };
55
Chris Forbes676003c2017-04-28 10:10:36 -070056# Use socket supplied by adbd, for cmd gpu vkjson etc.
57allow surfaceflinger adbd:unix_stream_socket { read write getattr };
58
Alex Klyubin5d30beb2017-02-07 10:05:07 -080059# Allow a dumpstate triggered screenshot
60binder_call(surfaceflinger, dumpstate)
61binder_call(surfaceflinger, shell)
62r_dir_file(surfaceflinger, dumpstate)
63
64# Needed on some devices for playing DRM protected content,
65# but seems expected and appropriate for all devices.
Alex Klyubin5d30beb2017-02-07 10:05:07 -080066allow surfaceflinger tee_device:chr_file rw_file_perms;
67
68
69# media.player service
70add_service(surfaceflinger, gpu_service)
71
72# do not use add_service() as hal_graphics_composer_default may be the
73# provider as well
74#add_service(surfaceflinger, surfaceflinger_service)
75allow surfaceflinger surfaceflinger_service:service_manager { add find };
76
77allow surfaceflinger mediaserver_service:service_manager find;
78allow surfaceflinger permission_service:service_manager find;
79allow surfaceflinger power_service:service_manager find;
Jeff Vander Stoep8bf3b7a2017-02-10 13:33:56 -080080allow surfaceflinger vr_manager_service:service_manager find;
Alex Klyubin5d30beb2017-02-07 10:05:07 -080081allow surfaceflinger window_service:service_manager find;
82
Jeff Vander Stoep8bf3b7a2017-02-10 13:33:56 -080083
Alex Klyubin5d30beb2017-02-07 10:05:07 -080084# allow self to set SCHED_FIFO
85allow surfaceflinger self:capability sys_nice;
86allow surfaceflinger proc_meminfo:file r_file_perms;
87r_dir_file(surfaceflinger, cgroup)
88r_dir_file(surfaceflinger, sysfs_type)
89r_dir_file(surfaceflinger, system_file)
90allow surfaceflinger tmpfs:dir r_dir_perms;
91allow surfaceflinger system_server:fd use;
92allow surfaceflinger ion_device:chr_file r_file_perms;
93
Nick Bray084faf02017-02-09 15:15:11 -080094# pdx IPC
Alex Vakulenko41daa7f2017-05-01 13:01:44 -070095pdx_server(surfaceflinger, display_client)
96pdx_server(surfaceflinger, display_manager)
97pdx_server(surfaceflinger, display_screenshot)
98pdx_server(surfaceflinger, display_vsync)
Nick Bray084faf02017-02-09 15:15:11 -080099
Alex Vakulenko41daa7f2017-05-01 13:01:44 -0700100pdx_client(surfaceflinger, bufferhub_client)
101pdx_client(surfaceflinger, performance_client)
Nick Bray084faf02017-02-09 15:15:11 -0800102
Alex Klyubin5d30beb2017-02-07 10:05:07 -0800103###
104### Neverallow rules
105###
106### surfaceflinger should NEVER do any of this
107
108# Do not allow accessing SDcard files as unsafe ejection could
109# cause the kernel to kill the process.
110neverallow surfaceflinger sdcard_type:file rw_file_perms;