Mount /microdroid_resources as tmpfs am: 2384e8abfe

Original change: https://android-review.googlesource.com/c/platform/system/core/+/3000936

Change-Id: Ied06eca140bea3d749067dc46b50aa98c842217f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Nikita Ioffe 2024-03-14 11:39:49 +00:00 committed by Automerger Merge Worker
commit 3109a477f7
2 changed files with 13 additions and 2 deletions

View file

@ -162,6 +162,7 @@ libinit_cc_defaults {
},
static_libs: [
"libavb",
"libavf_cc_flags",
"libbootloader_message",
"libc++fs",
"libcgrouprc_format",
@ -359,6 +360,7 @@ init_first_stage_cc_defaults {
static_libs: [
"libc++fs",
"libfs_avb",
"libavf_cc_flags",
"libfs_mgr",
"libfec",
"libfec_rs",
@ -459,7 +461,10 @@ cc_binary {
cc_binary {
name: "init_first_stage.microdroid",
defaults: ["init_first_stage_defaults"],
defaults: [
"avf_build_flags_cc",
"init_first_stage_defaults"
],
cflags: ["-DMICRODROID=1"],
installable: false,
}

View file

@ -37,6 +37,7 @@
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android/avf_cc_flags.h>
#include <modprobe/modprobe.h>
#include <private/android_filesystem_config.h>
@ -385,7 +386,12 @@ int FirstStageMain(int argc, char** argv) {
// /second_stage_resources is used to preserve files from first to second
// stage init
CHECKCALL(mount("tmpfs", kSecondStageRes, "tmpfs", MS_NOEXEC | MS_NOSUID | MS_NODEV,
"mode=0755,uid=0,gid=0"))
"mode=0755,uid=0,gid=0"));
if (IsMicrodroid() && android::virtualization::IsOpenDiceChangesFlagEnabled()) {
CHECKCALL(mount("tmpfs", "/microdroid_resources", "tmpfs", MS_NOEXEC | MS_NOSUID | MS_NODEV,
"mode=0750,uid=0,gid=0"));
}
#undef CHECKCALL
SetStdioToDevNull(argv);