Skip to content
Snippets Groups Projects
Commit e16fb910 authored by Jeff Vander Stoep's avatar Jeff Vander Stoep
Browse files

Properly Treble-ize tmpfs access

This is being done in preparation for the migration from ashmem to
memfd. In order for tmpfs objects to be usable across the Treble
boundary, they need to be declared in public policy whereas, they're
currently all declared in private policy as part of the
tmpfs_domain() macro. Remove the type declaration from the
macro, and remove tmpfs_domain() from the init_daemon_domain() macro
to avoid having to declare the *_tmpfs types for all init launched
domains. tmpfs is mostly used by apps and the media frameworks.

Bug: 122854450
Test: Boot Taimen and blueline. Watch videos, make phone calls, browse
internet, send text, install angry birds...play angry birds, keep
playing angry birds...

Change-Id: I20a47d2bb22e61b16187015c7bc7ca10accf6358
parent 0c742804
No related branches found
No related tags found
No related merge requests found
Showing with 22 additions and 5 deletions
......@@ -4,3 +4,4 @@
###
type mediaprovider, domain;
type mediaprovider_tmpfs, file_type;
# mediaserver - multimedia daemon
type mediaserver, domain;
type mediaserver_exec, system_file_type, exec_type, file_type;
type mediaserver_tmpfs, file_type;
typeattribute mediaserver mlstrustedsubject;
......
# Network stack service app
type network_stack, domain;
type network_stack_tmpfs, file_type;
# nfc subsystem
type nfc, domain;
type nfc_tmpfs, file_type;
......@@ -3,3 +3,4 @@
###
type platform_app, domain;
type platform_app_tmpfs, file_type;
......@@ -3,3 +3,4 @@
###
type priv_app, domain;
type priv_app_tmpfs, file_type;
# phone subsystem
type radio, domain, mlstrustedsubject;
type radio_tmpfs, file_type;
net_domain(radio)
bluetooth_domain(radio)
......
type runas_app, domain;
type runas_app_tmpfs, file_type;
# secure_element subsystem
type secure_element, domain;
type secure_element_tmpfs, file_type;
# Process which creates/updates shared RELRO files to be used by other apps.
type shared_relro, domain;
type shared_relro_tmpfs, file_type;
# Grant write access to the shared relro files/directory.
allow shared_relro shared_relro_file:dir rw_dir_perms;
......
# Domain for shell processes spawned by ADB or console service.
type shell, domain, mlstrustedsubject;
type shell_exec, system_file_type, exec_type, file_type;
type shell_tmpfs, file_type;
# Create and use network sockets.
net_domain(shell)
......
# All types must be defined regardless of build variant to ensure
# policy compilation succeeds with userdebug/user combination at boot
type su, domain;
type su_tmpfs, file_type;
# File types must be defined for file_contexts.
type su_exec, system_file_type, exec_type, file_type;
......
......@@ -5,3 +5,4 @@
###
type system_app, domain;
type system_app_tmpfs, file_type;
......@@ -3,3 +3,4 @@
# Most of the framework services run in this process.
#
type system_server, domain;
type system_server_tmpfs, file_type;
......@@ -72,13 +72,10 @@ allow $1 $2:{ file lnk_file } r_file_perms;
#####################################
# tmpfs_domain(domain)
# Define and allow access to a unique type for
# this domain when creating tmpfs / shmem / ashmem files.
# Allow access to a unique type for this domain when creating tmpfs / ashmem files.
define(`tmpfs_domain', `
type $1_tmpfs, file_type;
type_transition $1 tmpfs:file $1_tmpfs;
allow $1 $1_tmpfs:file { read write getattr map };
allow $1 tmpfs:dir { getattr search };
')
# pdx macros for IPC. pdx is a high-level name which contains transport-specific
......@@ -164,7 +161,6 @@ pdx_use($1, $2)
# upon executing its binary.
define(`init_daemon_domain', `
domain_auto_trans(init, $1_exec, $1)
tmpfs_domain($1)
')
#####################################
......
type traceur_app, domain;
type traceur_app_tmpfs, file_type;
allow traceur_app servicemanager:service_manager list;
allow traceur_app hwservicemanager:hwservice_manager list;
......
# ueventd seclabel is specified in init.rc since
# it lives in the rootfs and has no unique file type.
type ueventd, domain;
type ueventd_tmpfs, file_type;
# Write to /dev/kmsg.
allow ueventd kmsg_device:chr_file rw_file_perms;
......
......@@ -19,3 +19,6 @@
type untrusted_app, domain;
type untrusted_app_27, domain;
type untrusted_app_25, domain;
type untrusted_app_tmpfs, file_type;
type untrusted_app_27_tmpfs, file_type;
type untrusted_app_25_tmpfs, file_type;
......@@ -3,3 +3,4 @@
type webview_zygote, domain;
type webview_zygote_exec, exec_type, file_type;
type webview_zygote_tmpfs, file_type;
# zygote
type zygote, domain;
type zygote_tmpfs, file_type;
type zygote_exec, system_file_type, exec_type, file_type;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment