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

Commit db4f04cc authored by Sandro Montanari's avatar Sandro Montanari Committed by Automerger Merge Worker
Browse files

Merge "Remove /dev/selinux directory creation from first_stage_init.cpp" am:...

Merge "Remove /dev/selinux directory creation from first_stage_init.cpp" am: 4b3c063a am: 8ee78c7c

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



Change-Id: I069e9509c1b83958aaff90b8a43b310badaa76f5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 9cd97788 8ee78c7c
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -295,9 +295,6 @@ int FirstStageMain(int argc, char** argv) {
    // stage init
    // stage init
    CHECKCALL(mount("tmpfs", kSecondStageRes, "tmpfs", MS_NOEXEC | MS_NOSUID | MS_NODEV,
    CHECKCALL(mount("tmpfs", kSecondStageRes, "tmpfs", MS_NOEXEC | MS_NOSUID | MS_NODEV,
                    "mode=0755,uid=0,gid=0"))
                    "mode=0755,uid=0,gid=0"))

    // First stage init stores Mainline sepolicy here.
    CHECKCALL(mkdir("/dev/selinux", 0744));
#undef CHECKCALL
#undef CHECKCALL


    SetStdioToDevNull(argv);
    SetStdioToDevNull(argv);
+3 −2
Original line number Original line Diff line number Diff line
@@ -525,7 +525,7 @@ const std::vector<std::string> kApexSepolicy{"apex_file_contexts", "apex_propert
                                             "apex_service_contexts", "apex_seapp_contexts",
                                             "apex_service_contexts", "apex_seapp_contexts",
                                             "apex_test"};
                                             "apex_test"};


Result<void> CreateTmpfsDirIfNeeded() {
Result<void> CreateTmpfsDir() {
    mode_t mode = 0744;
    mode_t mode = 0744;
    struct stat stat_data;
    struct stat stat_data;
    if (stat(kTmpfsDir.c_str(), &stat_data) != 0) {
    if (stat(kTmpfsDir.c_str(), &stat_data) != 0) {
@@ -539,6 +539,7 @@ Result<void> CreateTmpfsDirIfNeeded() {
        if (!S_ISDIR(stat_data.st_mode)) {
        if (!S_ISDIR(stat_data.st_mode)) {
            return Error() << kTmpfsDir << " exists and is not a directory.";
            return Error() << kTmpfsDir << " exists and is not a directory.";
        }
        }
        LOG(WARNING) << "Directory " << kTmpfsDir << " already exists";
    }
    }


    // Need to manually call chmod because mkdir will create a folder with
    // Need to manually call chmod because mkdir will create a folder with
@@ -593,7 +594,7 @@ Result<void> GetPolicyFromApex(const std::string& dir) {


    auto handle_guard = android::base::make_scope_guard([&handle] { CloseArchive(handle); });
    auto handle_guard = android::base::make_scope_guard([&handle] { CloseArchive(handle); });


    auto create = CreateTmpfsDirIfNeeded();
    auto create = CreateTmpfsDir();
    if (!create.ok()) {
    if (!create.ok()) {
        return create.error();
        return create.error();
    }
    }