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

Commit 447a8886 authored by Kalesh Singh's avatar Kalesh Singh
Browse files

NativeLibraryHelper: Remove use of hardcoded PAGE_SIZE 4096



bionic hard codes the PAGE_SIZE macro as 4096. This is going away as
Android begins to support larger page sizes. Remove the usage of this
assumption from NativeLibraryHelper source; use instead getpagesize()
which provides the real pagesize.

Test: mma
Bug: 295082607
Change-Id: If59fdc17379adda1dcd6e78e754e7e17ef49423d
Signed-off-by: default avatarKalesh Singh <kaleshsingh@google.com>
parent 24c9102d
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ sumFiles(JNIEnv*, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntry, const char
static install_status_t
copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntry, const char* fileName)
{
    static const size_t kPageSize = getpagesize();
    void** args = reinterpret_cast<void**>(arg);
    jstring* javaNativeLibPath = (jstring*) args[0];
    jboolean extractNativeLibs = *(jboolean*) args[1];
@@ -200,9 +201,9 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr
            return INSTALL_FAILED_INVALID_APK;
        }

        if (offset % PAGE_SIZE != 0) {
            ALOGE("Library '%s' is not page-aligned - will not be able to open it directly from"
                " apk.\n", fileName);
        if (offset % kPageSize != 0) {
            ALOGE("Library '%s' is not PAGE(%zu)-aligned - will not be able to open it directly "
                  "from apk.\n", fileName, kPageSize);
            return INSTALL_FAILED_INVALID_APK;
        }