toolbox.te 1.1 KB

12345678910111213141516171819202122232425262728
  1. # Any toolbox command run by init.
  2. # At present, the only known usage is for running mkswap via fs_mgr.
  3. # Do NOT use this domain for toolbox when run by any other domain.
  4. type toolbox, domain;
  5. type toolbox_exec, system_file_type, exec_type, file_type;
  6. # /dev/__null__ created by init prior to policy load,
  7. # open fd inherited by fsck.
  8. allow toolbox tmpfs:chr_file { read write ioctl };
  9. # Inherit and use pty created by android_fork_execvp_ext().
  10. allow toolbox devpts:chr_file { read write getattr ioctl };
  11. # mkswap-specific.
  12. # Read/write block devices used for swap partitions.
  13. # Assign swap_block_device type any such partition in your
  14. # device/<vendor>/<product>/sepolicy/file_contexts file.
  15. allow toolbox block_device:dir search;
  16. allow toolbox swap_block_device:blk_file rw_file_perms;
  17. # Only allow entry from init via the toolbox binary.
  18. neverallow { domain -init } toolbox:process transition;
  19. neverallow * toolbox:process dyntransition;
  20. neverallow toolbox { file_type fs_type -toolbox_exec}:file entrypoint;
  21. # rm -rf directories in /data
  22. allow toolbox system_data_file:dir { rmdir rw_dir_perms };
  23. allow toolbox system_data_file:file { getattr unlink };