Tri Vo | bc8dc3a | 2019-05-26 13:17:08 -0700 | [diff] [blame^] | 1 | # surfaceflinger - display compositor service |
| 2 | |
| 3 | typeattribute surfaceflinger coredomain; |
| 4 | |
| 5 | type surfaceflinger_exec, system_file_type, exec_type, file_type; |
| 6 | init_daemon_domain(surfaceflinger) |
| 7 | tmpfs_domain(surfaceflinger) |
| 8 | |
| 9 | typeattribute surfaceflinger mlstrustedsubject; |
| 10 | typeattribute surfaceflinger display_service_server; |
| 11 | |
| 12 | read_runtime_log_tags(surfaceflinger) |
| 13 | |
| 14 | # Perform HwBinder IPC. |
| 15 | hal_client_domain(surfaceflinger, hal_graphics_allocator) |
| 16 | hal_client_domain(surfaceflinger, hal_graphics_composer) |
| 17 | typeattribute surfaceflinger_tmpfs hal_graphics_composer_client_tmpfs; |
| 18 | hal_client_domain(surfaceflinger, hal_omx) |
| 19 | hal_client_domain(surfaceflinger, hal_configstore) |
| 20 | hal_client_domain(surfaceflinger, hal_power) |
| 21 | hal_client_domain(surfaceflinger, hal_bufferhub) |
| 22 | allow surfaceflinger hidl_token_hwservice:hwservice_manager find; |
| 23 | |
| 24 | # Perform Binder IPC. |
| 25 | binder_use(surfaceflinger) |
| 26 | binder_call(surfaceflinger, binderservicedomain) |
| 27 | binder_call(surfaceflinger, appdomain) |
| 28 | binder_call(surfaceflinger, bootanim) |
| 29 | binder_service(surfaceflinger) |
| 30 | |
| 31 | # Binder IPC to bu, presently runs in adbd domain. |
| 32 | binder_call(surfaceflinger, adbd) |
| 33 | |
| 34 | # Read /proc/pid files for Binder clients. |
| 35 | r_dir_file(surfaceflinger, binderservicedomain) |
| 36 | r_dir_file(surfaceflinger, appdomain) |
| 37 | |
| 38 | # Access the GPU. |
| 39 | allow surfaceflinger gpu_device:chr_file rw_file_perms; |
| 40 | |
| 41 | # Access /dev/graphics/fb0. |
| 42 | allow surfaceflinger graphics_device:dir search; |
| 43 | allow surfaceflinger graphics_device:chr_file rw_file_perms; |
| 44 | |
| 45 | # Access /dev/video1. |
| 46 | allow surfaceflinger video_device:dir r_dir_perms; |
| 47 | allow surfaceflinger video_device:chr_file rw_file_perms; |
| 48 | |
| 49 | # Create and use netlink kobject uevent sockets. |
| 50 | allow surfaceflinger self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; |
| 51 | |
| 52 | # Set properties. |
| 53 | set_prop(surfaceflinger, system_prop) |
| 54 | set_prop(surfaceflinger, exported_system_prop) |
| 55 | set_prop(surfaceflinger, exported2_system_prop) |
| 56 | set_prop(surfaceflinger, exported3_system_prop) |
| 57 | set_prop(surfaceflinger, ctl_bootanim_prop) |
| 58 | |
| 59 | # Use open files supplied by an app. |
| 60 | allow surfaceflinger appdomain:fd use; |
| 61 | allow surfaceflinger { app_data_file privapp_data_file }:file { read write }; |
| 62 | |
| 63 | # Allow writing surface traces to /data/misc/wmtrace. |
| 64 | userdebug_or_eng(` |
| 65 | allow surfaceflinger wm_trace_data_file:dir rw_dir_perms; |
| 66 | allow surfaceflinger wm_trace_data_file:file { getattr setattr create w_file_perms }; |
| 67 | ') |
| 68 | |
| 69 | # Use socket supplied by adbd, for cmd gpu vkjson etc. |
| 70 | allow surfaceflinger adbd:unix_stream_socket { read write getattr }; |
| 71 | |
| 72 | # Allow a dumpstate triggered screenshot |
| 73 | binder_call(surfaceflinger, dumpstate) |
| 74 | binder_call(surfaceflinger, shell) |
| 75 | r_dir_file(surfaceflinger, dumpstate) |
| 76 | |
| 77 | # media.player service |
| 78 | |
| 79 | # do not use add_service() as hal_graphics_composer_default may be the |
| 80 | # provider as well |
| 81 | #add_service(surfaceflinger, surfaceflinger_service) |
| 82 | allow surfaceflinger surfaceflinger_service:service_manager { add find }; |
| 83 | |
| 84 | add_service(surfaceflinger, vrflinger_vsync_service) |
| 85 | |
| 86 | allow surfaceflinger mediaserver_service:service_manager find; |
| 87 | allow surfaceflinger permission_service:service_manager find; |
| 88 | allow surfaceflinger power_service:service_manager find; |
| 89 | allow surfaceflinger vr_manager_service:service_manager find; |
| 90 | allow surfaceflinger window_service:service_manager find; |
| 91 | allow surfaceflinger inputflinger_service:service_manager find; |
| 92 | |
| 93 | |
| 94 | # allow self to set SCHED_FIFO |
| 95 | allow surfaceflinger self:global_capability_class_set sys_nice; |
| 96 | allow surfaceflinger proc_meminfo:file r_file_perms; |
| 97 | r_dir_file(surfaceflinger, cgroup) |
| 98 | r_dir_file(surfaceflinger, system_file) |
| 99 | allow surfaceflinger tmpfs:dir r_dir_perms; |
| 100 | allow surfaceflinger system_server:fd use; |
| 101 | allow surfaceflinger system_server:unix_stream_socket { read write }; |
| 102 | allow surfaceflinger ion_device:chr_file r_file_perms; |
| 103 | |
| 104 | # pdx IPC |
| 105 | pdx_server(surfaceflinger, display_client) |
| 106 | pdx_server(surfaceflinger, display_manager) |
| 107 | pdx_server(surfaceflinger, display_screenshot) |
| 108 | pdx_server(surfaceflinger, display_vsync) |
| 109 | |
| 110 | pdx_client(surfaceflinger, bufferhub_client) |
| 111 | pdx_client(surfaceflinger, performance_client) |
| 112 | |
| 113 | ### |
| 114 | ### Neverallow rules |
| 115 | ### |
| 116 | ### surfaceflinger should NEVER do any of this |
| 117 | |
| 118 | # Do not allow accessing SDcard files as unsafe ejection could |
| 119 | # cause the kernel to kill the process. |
| 120 | neverallow surfaceflinger sdcard_type:file rw_file_perms; |
| 121 | |
| 122 | # b/68864350 |
| 123 | dontaudit surfaceflinger unlabeled:dir search; |