blob: c5086120996b0ab444c463c4e5f8ab115f907600 [file] [log] [blame]
Stephen Smalley2dd4e512012-01-04 12:33:27 -05001# surfaceflinger - display compositor service
2type surfaceflinger, domain;
3type surfaceflinger_exec, exec_type, file_type;
4
5init_daemon_domain(surfaceflinger)
Stephen Smalley52a85232013-10-29 14:42:40 -04006typeattribute surfaceflinger mlstrustedsubject;
Stephen Smalley2dd4e512012-01-04 12:33:27 -05007
8# Talk to init over the property socket.
9unix_socket_connect(surfaceflinger, property, init)
Stephen Smalley52a85232013-10-29 14:42:40 -040010
11# Perform Binder IPC.
12binder_use(surfaceflinger)
Stephen Smalley244aa022014-03-05 10:17:16 -050013binder_call(surfaceflinger, binderservicedomain)
14binder_call(surfaceflinger, appdomain)
Nick Kralevichfd352f12014-04-16 16:31:23 -070015binder_call(surfaceflinger, bootanim)
Stephen Smalley52a85232013-10-29 14:42:40 -040016binder_service(surfaceflinger)
Stephen Smalley52a85232013-10-29 14:42:40 -040017
Stephen Smalley244aa022014-03-05 10:17:16 -050018# Binder IPC to bu, presently runs in adbd domain.
19binder_call(surfaceflinger, adbd)
20
21# Read /proc/pid files for Binder clients.
22r_dir_file(surfaceflinger, binderservicedomain)
23r_dir_file(surfaceflinger, appdomain)
24
Stephen Smalley3ba90122013-12-12 09:09:53 -050025# Access the GPU.
26allow surfaceflinger gpu_device:chr_file rw_file_perms;
27
Stephen Smalley52a85232013-10-29 14:42:40 -040028# Access /dev/graphics/fb0.
29allow surfaceflinger graphics_device:dir search;
30allow surfaceflinger graphics_device:chr_file rw_file_perms;
31
32# Access /dev/video1.
Nick Kralevich37339c72014-01-06 12:39:19 -080033allow surfaceflinger video_device:dir r_dir_perms;
Stephen Smalley52a85232013-10-29 14:42:40 -040034allow surfaceflinger video_device:chr_file rw_file_perms;
35
36# Create and use netlink kobject uevent sockets.
Stephen Smalley16011322014-02-24 15:06:11 -050037allow surfaceflinger self:netlink_kobject_uevent_socket create_socket_perms;
Stephen Smalley52a85232013-10-29 14:42:40 -040038
39# Set properties.
40allow surfaceflinger system_prop:property_service set;
Robert Craig4b3893f2014-02-18 13:24:26 -050041allow surfaceflinger ctl_bootanim_prop:property_service set;
Stephen Smalley52a85232013-10-29 14:42:40 -040042
43# Use open files supplied by an app.
44allow surfaceflinger appdomain:fd use;
Stephen Smalley52a85232013-10-29 14:42:40 -040045allow surfaceflinger app_data_file:file { read write };
Stephen Smalleyacde43f2013-12-11 15:17:53 -050046
47# Use open file provided by bootanim.
48allow surfaceflinger bootanim:fd use;
Nick Kralevich3d770d22014-01-06 14:04:34 -080049
50# Allow a dumpstate triggered screenshot
51binder_call(surfaceflinger, dumpstate)
Stephen Smalleya5066132014-01-07 13:25:25 -050052binder_call(surfaceflinger, shell)
Stephen Smalley57955712014-03-21 10:36:24 -040053r_dir_file(surfaceflinger, dumpstate)
Nick Kraleviche45603d2014-01-08 11:19:52 -080054
55# Needed on some devices for playing DRM protected content,
56# but seems expected and appropriate for all devices.
57allow surfaceflinger tee:unix_stream_socket connectto;
58allow surfaceflinger tee_device:chr_file rw_file_perms;
Stephen Smalley244aa022014-03-05 10:17:16 -050059
Riley Spahnf90c41f2014-06-05 15:52:02 -070060allow surfaceflinger surfaceflinger_service:service_manager add;
61
Stephen Smalley244aa022014-03-05 10:17:16 -050062###
63### Neverallow rules
64###
65### surfaceflinger should NEVER do any of this
66
67# Do not allow accessing SDcard files as unsafe ejection could
68# cause the kernel to kill the process.
Nick Kralevichb53e84a2014-06-08 22:30:58 -070069neverallow surfaceflinger sdcard_type:file rw_file_perms;