blob: 3be2c1b12ea165359a249e7800c214188a9ed00c [file] [log] [blame]
Stephen Smalley2dd4e512012-01-04 12:33:27 -05001# surfaceflinger - display compositor service
2type surfaceflinger, domain;
Nick Kralevich623975f2014-01-11 01:31:03 -08003permissive_or_unconfined(surfaceflinger)
Stephen Smalley2dd4e512012-01-04 12:33:27 -05004type surfaceflinger_exec, exec_type, file_type;
5
6init_daemon_domain(surfaceflinger)
Stephen Smalley52a85232013-10-29 14:42:40 -04007typeattribute surfaceflinger mlstrustedsubject;
Stephen Smalley2dd4e512012-01-04 12:33:27 -05008
9# Talk to init over the property socket.
10unix_socket_connect(surfaceflinger, property, init)
Stephen Smalley52a85232013-10-29 14:42:40 -040011
12# Perform Binder IPC.
13binder_use(surfaceflinger)
Stephen Smalley244aa022014-03-05 10:17:16 -050014binder_call(surfaceflinger, binderservicedomain)
15binder_call(surfaceflinger, appdomain)
Nick Kralevichfd352f12014-04-16 16:31:23 -070016binder_call(surfaceflinger, bootanim)
Stephen Smalley52a85232013-10-29 14:42:40 -040017binder_service(surfaceflinger)
Stephen Smalley52a85232013-10-29 14:42:40 -040018
Stephen Smalley244aa022014-03-05 10:17:16 -050019# Binder IPC to bu, presently runs in adbd domain.
20binder_call(surfaceflinger, adbd)
21
22# Read /proc/pid files for Binder clients.
23r_dir_file(surfaceflinger, binderservicedomain)
24r_dir_file(surfaceflinger, appdomain)
25
Stephen Smalley3ba90122013-12-12 09:09:53 -050026# Access the GPU.
27allow surfaceflinger gpu_device:chr_file rw_file_perms;
28
Stephen Smalley52a85232013-10-29 14:42:40 -040029# Access /dev/graphics/fb0.
30allow surfaceflinger graphics_device:dir search;
31allow surfaceflinger graphics_device:chr_file rw_file_perms;
32
Greg Hackmann70047892014-05-06 15:42:18 -070033# Access ADF device nodes.
34allow surfaceflinger adf_device:chr_file rw_file_perms;
35
Stephen Smalley52a85232013-10-29 14:42:40 -040036# Access /dev/video1.
Nick Kralevich37339c72014-01-06 12:39:19 -080037allow surfaceflinger video_device:dir r_dir_perms;
Stephen Smalley52a85232013-10-29 14:42:40 -040038allow surfaceflinger video_device:chr_file rw_file_perms;
39
40# Create and use netlink kobject uevent sockets.
Stephen Smalley16011322014-02-24 15:06:11 -050041allow surfaceflinger self:netlink_kobject_uevent_socket create_socket_perms;
Stephen Smalley52a85232013-10-29 14:42:40 -040042
43# Set properties.
44allow surfaceflinger system_prop:property_service set;
Robert Craig4b3893f2014-02-18 13:24:26 -050045allow surfaceflinger ctl_bootanim_prop:property_service set;
Stephen Smalley52a85232013-10-29 14:42:40 -040046
47# Use open files supplied by an app.
48allow surfaceflinger appdomain:fd use;
Stephen Smalley52a85232013-10-29 14:42:40 -040049allow surfaceflinger app_data_file:file { read write };
Stephen Smalleyacde43f2013-12-11 15:17:53 -050050
51# Use open file provided by bootanim.
52allow surfaceflinger bootanim:fd use;
Nick Kralevich3d770d22014-01-06 14:04:34 -080053
54# Allow a dumpstate triggered screenshot
55binder_call(surfaceflinger, dumpstate)
Stephen Smalleya5066132014-01-07 13:25:25 -050056binder_call(surfaceflinger, shell)
Stephen Smalley57955712014-03-21 10:36:24 -040057r_dir_file(surfaceflinger, dumpstate)
Nick Kraleviche45603d2014-01-08 11:19:52 -080058
59# Needed on some devices for playing DRM protected content,
60# but seems expected and appropriate for all devices.
61allow surfaceflinger tee:unix_stream_socket connectto;
62allow surfaceflinger tee_device:chr_file rw_file_perms;
Stephen Smalley244aa022014-03-05 10:17:16 -050063
64###
65### Neverallow rules
66###
67### surfaceflinger should NEVER do any of this
68
69# Do not allow accessing SDcard files as unsafe ejection could
70# cause the kernel to kill the process.
71# TODO: Remove -unconfineddomain when we remove permissive_or_unconfined above.
72neverallow { surfaceflinger -unconfineddomain } sdcard_type:file rw_file_perms;