Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9829a8c5 authored by Jiyong Park's avatar Jiyong Park Committed by android-build-merger
Browse files

Proper mount namespace configuration for bionic am: 6866041f

am: 43505e3f

Change-Id: Ia29bf355c839bc9f8d5b8f1b6210a147c2fe6ccf
parents c2ad0987 43505e3f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ cc_library_static {
        "init.cpp",
        "keychords.cpp",
        "modalias_handler.cpp",
        "mount_namespace.cpp",
        "parser.cpp",
        "persistent_properties.cpp",
        "persistent_properties.proto",
@@ -166,6 +167,7 @@ cc_binary {
            exclude_shared_libs: ["libbinder", "libutils"],
        },
    },
    ldflags: ["-Wl,--rpath,/system/${LIB}/bootstrap"],
}

// Tests
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ LOCAL_SRC_FILES := \
    first_stage_init.cpp \
    first_stage_main.cpp \
    first_stage_mount.cpp \
    mount_namespace.cpp \
    reboot_utils.cpp \
    selinux.cpp \
    switch_root.cpp \
+10 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@
#include "action_manager.h"
#include "bootchart.h"
#include "init.h"
#include "mount_namespace.h"
#include "parser.h"
#include "property_service.h"
#include "reboot.h"
@@ -1098,6 +1099,14 @@ static Result<Success> do_parse_apex_configs(const BuiltinArguments& args) {
    }
}

static Result<Success> do_setup_runtime_bionic(const BuiltinArguments& args) {
    if (SwitchToDefaultMountNamespace()) {
        return Success();
    } else {
        return Error() << "Failed to setup runtime bionic";
    }
}

// Builtin-function-map start
const BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const {
    constexpr std::size_t kMax = std::numeric_limits<std::size_t>::max();
@@ -1145,6 +1154,7 @@ const BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const {
        {"rmdir",                   {1,     1,    {true,   do_rmdir}}},
        {"setprop",                 {2,     2,    {true,   do_setprop}}},
        {"setrlimit",               {3,     3,    {false,  do_setrlimit}}},
        {"setup_runtime_bionic",    {0,     0,    {false,  do_setup_runtime_bionic}}},
        {"start",                   {1,     1,    {false,  do_start}}},
        {"stop",                    {1,     1,    {false,  do_stop}}},
        {"swapon_all",              {1,     1,    {false,  do_swapon_all}}},
+0 −4
Original line number Diff line number Diff line
@@ -136,10 +136,6 @@ static inline bool IsDtVbmetaCompatible(const Fstab& fstab) {
    return is_android_dt_value_expected("vbmeta/compatible", "android,vbmeta");
}

static bool IsRecoveryMode() {
    return access("/system/bin/recovery", F_OK) == 0;
}

static Fstab ReadFirstStageFstab() {
    Fstab fstab;
    if (!ReadFstabFromDt(&fstab)) {
+5 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@
#include "first_stage_mount.h"
#include "import_parser.h"
#include "keychords.h"
#include "mount_namespace.h"
#include "property_service.h"
#include "reboot.h"
#include "reboot_utils.h"
@@ -666,6 +667,10 @@ int SecondStageMain(int argc, char** argv) {
    const BuiltinFunctionMap function_map;
    Action::set_function_map(&function_map);

    if (!SetupMountNamespaces()) {
        PLOG(FATAL) << "SetupMountNamespaces failed";
    }

    subcontexts = InitializeSubcontexts();

    ActionManager& am = ActionManager::GetInstance();
Loading