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

Commit cb4704f3 authored by Jooyung Han's avatar Jooyung Han Committed by Gerrit Code Review
Browse files

Merge "init: "init subcontext" in default mount namespace"

parents 7259edac 7bfe477b
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@

#include "action.h"
#include "builtins.h"
#include "mount_namespace.h"
#include "proto_utils.h"
#include "util.h"

@@ -217,7 +218,13 @@ void Subcontext::Fork() {
                PLOG(FATAL) << "Could not set execcon for '" << context_ << "'";
            }
        }

#if defined(__ANDROID__)
        // subcontext init runs in "default" mount namespace
        // so that it can access /apex/*
        if (auto result = SwitchToMountNamespaceIfNeeded(NS_DEFAULT); !result.ok()) {
            LOG(FATAL) << "Could not switch to \"default\" mount namespace: " << result.error();
        }
#endif
        auto init_path = GetExecutablePath();
        auto child_fd_string = std::to_string(child_fd);
        const char* args[] = {init_path.c_str(), "subcontext", context_.c_str(),