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

Commit df09f80c authored by Kalesh Singh's avatar Kalesh Singh Committed by Gerrit Code Review
Browse files

Merge "init: snapuserd: Fix ranges for mlock()" into main

parents 0288e960 f90de49e
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -195,22 +195,20 @@ static void LockAllSystemPages() {
            return;
        }
        auto start = reinterpret_cast<const void*>(map.start);
        auto len = map.end - map.start;
        uint64_t len = android::procinfo::MappedFileSize(map);
        if (!len) {
            return;
        }

        if (mlock(start, len) < 0) {
            LOG(ERROR) << "mlock failed, " << start << " for " << len << " bytes.";
            PLOG(ERROR) << "\"" << map.name << "\": mlock(" << start << ", " << len
                        << ") failed: pgoff = " << map.pgoff;
            ok = false;
        }
    };

    if (!android::procinfo::ReadProcessMaps(getpid(), callback) || !ok) {
        LOG(FATAL) << "Could not process /proc/" << getpid() << "/maps file for init, "
                   << "falling back to mlockall().";
        if (mlockall(MCL_CURRENT) < 0) {
            LOG(FATAL) << "mlockall failed";
        }
        LOG(FATAL) << "Could not process /proc/" << getpid() << "/maps file for init";
    }
}