From cee7fcd0016ef0e983d14256b4c9c63c37dc2ee4 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 14 Dec 2023 14:03:07 -0800 Subject: [PATCH] Mount /tmp as tmpfs. /tmp is a volatile temporary storage location for the shell user. As with /data/local/tmp, it is owned by shell:shell and is chmod 771. Bug: 311263616 Change-Id: Ice0229d937989b097971d9db434d5589ac2da99a --- rootdir/Android.mk | 2 +- rootdir/init.rc | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rootdir/Android.mk b/rootdir/Android.mk index 7deb17324..7444f963f 100644 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -97,7 +97,7 @@ endif # create some directories (some are mount points) and symlinks LOCAL_POST_INSTALL_CMD := mkdir -p $(addprefix $(TARGET_ROOT_OUT)/, \ dev proc sys system data data_mirror odm oem acct config storage mnt apex bootstrap-apex debug_ramdisk \ - linkerconfig second_stage_resources postinstall $(BOARD_ROOT_EXTRA_FOLDERS)); \ + linkerconfig second_stage_resources postinstall tmp $(BOARD_ROOT_EXTRA_FOLDERS)); \ ln -sf /system/bin $(TARGET_ROOT_OUT)/bin; \ ln -sf /system/etc $(TARGET_ROOT_OUT)/etc; \ ln -sf /data/user_de/0/com.android.shell/files/bugreports $(TARGET_ROOT_OUT)/bugreports; \ diff --git a/rootdir/init.rc b/rootdir/init.rc index fb6473666..12c46ebfe 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -92,6 +92,12 @@ on early-init # checker programs. mkdir /dev/fscklogs 0770 root system + # Create tmpfs for use by the shell user. + mount tmpfs tmpfs /tmp + restorecon /tmp + chown shell shell /tmp + chmod 0771 /tmp + on init sysclktz 0