Open lisa-bella97 opened 1 month ago
Yes, this one is critical. Would be great if you could fix it in the upcoming release
Looks like there are page size assumptions in the native code that are used when compiling: https://github.com/java-native-access/jna/blob/c9e389567554df573e4466b44d78e937812325c8/native/libffi/src/dlmalloc.c#L1215-L1258
I assume the native library version with the distribution was likely compiled on a smaller page size. Can you compile the native library on the system with the higher page size and does it resolve the problem?
Based on Googles recommendations the code should be updated;
Check for code instances that reference specific page sizes
Even if your app is 16 KB-aligned, your app can encounter errors if places in your code assume that a device is using a specific page size. To avoid this, complete the following steps:
Remove any hard-coded dependencies that reference the [PAGE_SIZE](https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/bits/page_size.h;l=34-39) constant or instances in your code logic that assume that a device's page size is 4 KB (4096).
Use [getpagesize()](https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/bionic/getpagesize.cpp;l=32) or [sysconf(_SC_PAGESIZE)](https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/bionic/sysconf.cpp;l=151) instead.
System.loadLibrary("jnidispatch")
is OK on Android 15 or less with 4 KB page size, but is not OK (leads to SIGSEGV crash) on Android 15 with 16 KB page size (support of this page size in Android 15 is described in docs).System.loadLibrary("jnidispatch")
is called on Android platform inloadNativeDispatchLibrary
function that is called in static block of JNA classNative
, so you cannot properly use, for example,Native.load
function on Android 15 with 16 KB page size. To test this behaviour, corresponding Android Studio emulators were used. Info about emulator: Emulator version: 35.1.13-11943732 (HVF 14.5.0) Host machine: macOS 14.5 Api level: 35 Type: Google APIs PlayStore Page Size 16 KB