RFR: 8318737: Fallback linker passes bad JNI handle [v2]
Jorn Vernee
jvernee at openjdk.org
Wed Oct 25 11:16:56 UTC 2023
On Wed, 25 Oct 2023 09:32:42 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
>>
>> explicitly propagate fallback library init failures
>
> src/java.base/share/native/libfallbackLinker/fallbackLinker.c line 52:
>
>> 50: return; // let caller deal with exception
>> 51: }
>> 52: LibFallback_class = (*env)->NewGlobalRef(env, LibFallback_class_local);
>
> I think `NewGlobalRef` can return `nullptr` on OOME: https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html#NewGlobalRef
>
> We should check for this too?
I've improved the initialization logic of the surrounding fields as well. Now we explicitly report errors back to the caller (using a boolean return value), which can then throw an exception when the library fails to initialize.
See: https://github.com/openjdk/jdk/pull/16349/commits/dd74cdb9dbe7a05386a18156e7a174c9c8546b1a
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16349#discussion_r1371562428
More information about the core-libs-dev
mailing list