RFR: JDK-8275703: System.loadLibrary fails on Big Sur for libraries hidden from filesystem

Jaikiran Pai jpai at openjdk.java.net
Wed Oct 27 02:54:08 UTC 2021


On Tue, 26 Oct 2021 22:51:29 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> On, macOS 11.x, system libraries are loaded from dynamic linker cache.  The libraries are no longer present on the filesystem.   `NativeLibraries::loadLibrary` checks for the file existence before calling `JVM_LoadLibrary`.   Such check no longer applies on Big Sur.   This proposes that on macOS >= 11, it will skip the file existence check and attempt to load a library for each path from java.library.path and system library path.

src/java.base/macosx/classes/jdk/internal/loader/ClassLoaderHelper.java line 44:

> 42:             } catch (NumberFormatException e) {}
> 43:         }
> 44:         hasDynamicLoaderCache = major >= 11;

Hello Mandy,
I'm not too familiar with MacOS versioning schemes. However, in this specific logic, if the `os.version` value doesn't contain a dot character, then the `major` is initialized to `11`, which would then evaluate this `hasDynamicLoaderCache` to `true`. That would mean if the `os.version` is (for example) `10`, then `hasDynamicLoaderCache` will be incorrectly set to `true` here, isn't it?

-------------

PR: https://git.openjdk.java.net/jdk/pull/6127


More information about the core-libs-dev mailing list