mediaextractor.te 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # mediaextractor - multimedia daemon
  2. type mediaextractor, domain;
  3. type mediaextractor_exec, system_file_type, exec_type, file_type;
  4. type mediaextractor_tmpfs, file_type;
  5. typeattribute mediaextractor mlstrustedsubject;
  6. binder_use(mediaextractor)
  7. binder_call(mediaextractor, binderservicedomain)
  8. binder_call(mediaextractor, appdomain)
  9. binder_service(mediaextractor)
  10. add_service(mediaextractor, mediaextractor_service)
  11. allow mediaextractor mediametrics_service:service_manager find;
  12. allow mediaextractor hidl_token_hwservice:hwservice_manager find;
  13. allow mediaextractor system_server:fd use;
  14. hal_client_domain(mediaextractor, hal_cas)
  15. hal_client_domain(mediaextractor, hal_allocator)
  16. r_dir_file(mediaextractor, cgroup)
  17. allow mediaextractor proc_meminfo:file r_file_perms;
  18. crash_dump_fallback(mediaextractor)
  19. # allow mediaextractor read permissions for file sources
  20. allow mediaextractor sdcard_type:file { getattr read };
  21. allow mediaextractor media_rw_data_file:file { getattr read };
  22. allow mediaextractor { app_data_file privapp_data_file }:file { getattr read };
  23. # Read resources from open apk files passed over Binder
  24. allow mediaextractor apk_data_file:file { read getattr };
  25. allow mediaextractor asec_apk_file:file { read getattr };
  26. allow mediaextractor ringtone_file:file { read getattr };
  27. # scan extractor library directory to dynamically load extractors
  28. allow mediaextractor system_file:dir { read open };
  29. get_prop(mediaextractor, device_config_media_native_prop)
  30. ###
  31. ### neverallow rules
  32. ###
  33. # mediaextractor should never execute any executable without a
  34. # domain transition
  35. neverallow mediaextractor { file_type fs_type }:file execute_no_trans;
  36. # The goal of the mediaserver split is to place media processing code into
  37. # restrictive sandboxes with limited responsibilities and thus limited
  38. # permissions. Example: Audioserver is only responsible for controlling audio
  39. # hardware and processing audio content. Cameraserver does the same for camera
  40. # hardware/content. Etc.
  41. #
  42. # Media processing code is inherently risky and thus should have limited
  43. # permissions and be isolated from the rest of the system and network.
  44. # Lengthier explanation here:
  45. # https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
  46. neverallow mediaextractor domain:{ tcp_socket udp_socket rawip_socket } *;
  47. # mediaextractor should not be opening /data files directly. Any files
  48. # it touches (with a few exceptions) need to be passed to it via a file
  49. # descriptor opened outside the process.
  50. neverallow mediaextractor {
  51. data_file_type
  52. -zoneinfo_data_file # time zone data from /data/misc/zoneinfo
  53. userdebug_or_eng(`-apk_data_file') # for loading media extractor plugins
  54. with_native_coverage(`-method_trace_data_file')
  55. }:file open;