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
diff --git a/private/audioserver.te b/private/audioserver.te
index 6482c61..0bc52bf 100644
--- a/private/audioserver.te
+++ b/private/audioserver.te
@@ -4,6 +4,7 @@
type audioserver_exec, exec_type, file_type, system_file_type;
init_daemon_domain(audioserver)
+tmpfs_domain(audioserver)
r_dir_file(audioserver, sdcard_type)
diff --git a/private/compat/28.0/28.0.ignore.cil b/private/compat/28.0/28.0.ignore.cil
index 97830c1..b0a32e4 100644
--- a/private/compat/28.0/28.0.ignore.cil
+++ b/private/compat/28.0/28.0.ignore.cil
@@ -18,6 +18,7 @@
apexd_prop
apexd_tmpfs
app_zygote
+ app_zygote_tmpfs
biometric_service
bpf_progs_loaded_prop
bugreport_service
@@ -75,6 +76,7 @@
mnt_product_file
network_stack
network_stack_service
+ network_stack_tmpfs
overlayfs_file
permissionmgr_service
recovery_socket
@@ -85,11 +87,13 @@
rss_hwm_reset
rss_hwm_reset_exec
runas_app
+ runas_app_tmpfs
runtime_service
sensor_privacy_service
server_configurable_flags_data_file
simpleperf_app_runner
simpleperf_app_runner_exec
+ su_tmpfs
super_block_device
system_event_log_tags_file
system_lmk_prop
diff --git a/private/dexoptanalyzer.te b/private/dexoptanalyzer.te
index 212608b..ab24120 100644
--- a/private/dexoptanalyzer.te
+++ b/private/dexoptanalyzer.te
@@ -1,6 +1,7 @@
# dexoptanalyzer
type dexoptanalyzer, domain, coredomain, mlstrustedsubject;
type dexoptanalyzer_exec, system_file_type, exec_type, file_type;
+type dexoptanalyzer_tmpfs, file_type;
# Reading an APK opens a ZipArchive, which unpack to tmpfs.
# Use tmpfs_domain() which will give tmpfs files created by dexoptanalyzer their
diff --git a/private/logd.te b/private/logd.te
index 4338e40..321727b 100644
--- a/private/logd.te
+++ b/private/logd.te
@@ -4,10 +4,8 @@
# logd is not allowed to write anywhere other than /data/misc/logd, and then
# only on userdebug or eng builds
-# TODO: deal with tmpfs_domain pub/priv split properly
neverallow logd {
file_type
- -logd_tmpfs
-runtime_event_log_tags_file
userdebug_or_eng(`-coredump_file -misc_logd_file')
}:file { create write append };
diff --git a/private/mediaextractor.te b/private/mediaextractor.te
index c1a8521..eb90cdc 100644
--- a/private/mediaextractor.te
+++ b/private/mediaextractor.te
@@ -1,3 +1,4 @@
typeattribute mediaextractor coredomain;
init_daemon_domain(mediaextractor)
+tmpfs_domain(mediaextractor)
diff --git a/private/mediaserver.te b/private/mediaserver.te
index 4c30bc0..b1cf64a 100644
--- a/private/mediaserver.te
+++ b/private/mediaserver.te
@@ -1,6 +1,7 @@
typeattribute mediaserver coredomain;
init_daemon_domain(mediaserver)
+tmpfs_domain(mediaserver)
# allocate and use graphic buffers
hal_client_domain(mediaserver, hal_graphics_allocator)
diff --git a/private/perfetto.te b/private/perfetto.te
index 2e43d90..128205b 100644
--- a/private/perfetto.te
+++ b/private/perfetto.te
@@ -4,6 +4,7 @@
# daemon.
type perfetto_exec, system_file_type, exec_type, file_type;
+type perfetto_tmpfs, file_type;
tmpfs_domain(perfetto);
diff --git a/private/recovery_persist.te b/private/recovery_persist.te
index 1fdd758..2d244fd 100644
--- a/private/recovery_persist.te
+++ b/private/recovery_persist.te
@@ -3,5 +3,4 @@
init_daemon_domain(recovery_persist)
# recovery_persist is not allowed to write anywhere other than recovery_data_file
-# TODO: deal with tmpfs_domain pub/priv split properly
-neverallow recovery_persist { file_type -recovery_data_file -recovery_persist_tmpfs userdebug_or_eng(`-coredump_file') }:file write;
+neverallow recovery_persist { file_type -recovery_data_file userdebug_or_eng(`-coredump_file') }:file write;
diff --git a/private/recovery_refresh.te b/private/recovery_refresh.te
index 327098d..b6cd56f 100644
--- a/private/recovery_refresh.te
+++ b/private/recovery_refresh.te
@@ -3,5 +3,4 @@
init_daemon_domain(recovery_refresh)
# recovery_refresh is not allowed to write anywhere
-# TODO: deal with tmpfs_domain pub/priv split properly
-neverallow recovery_refresh { file_type -recovery_refresh_tmpfs userdebug_or_eng(`-coredump_file') }:file write;
+neverallow recovery_refresh { file_type userdebug_or_eng(`-coredump_file') }:file write;
diff --git a/private/system_server_startup.te b/private/system_server_startup.te
index 4bd10c8..bd7b2c0 100644
--- a/private/system_server_startup.te
+++ b/private/system_server_startup.te
@@ -1,4 +1,5 @@
type system_server_startup, domain, coredomain;
+type system_server_startup_tmpfs, file_type;
tmpfs_domain(system_server_startup)
diff --git a/private/traced.te b/private/traced.te
index 33c5ac0..6dae15c 100644
--- a/private/traced.te
+++ b/private/traced.te
@@ -1,9 +1,11 @@
# Perfetto user-space tracing daemon (unprivileged)
type traced, domain, coredomain, mlstrustedsubject;
type traced_exec, system_file_type, exec_type, file_type;
+type traced_tmpfs, file_type;
# Allow init to exec the daemon.
init_daemon_domain(traced)
+tmpfs_domain(traced)
# Allow apps in other MLS contexts (for multi-user) to access
# share memory buffers created by traced.
diff --git a/private/viewcompiler.te b/private/viewcompiler.te
index 14009c6..3c9c1ee 100644
--- a/private/viewcompiler.te
+++ b/private/viewcompiler.te
@@ -1,6 +1,7 @@
# viewcompiler
type viewcompiler, domain, coredomain, mlstrustedsubject;
type viewcompiler_exec, system_file_type, exec_type, file_type;
+type viewcompiler_tmpfs, file_type;
# Reading an APK opens a ZipArchive, which unpack to tmpfs.
# Use tmpfs_domain() which will give tmpfs files created by viewcompiler their