RFR: 8358537: (bf) JavaNioAccess::getBufferAddress bypasses direct buffer MemorySession state check
Alan Bateman
alanb at openjdk.org
Wed Jun 4 09:03:18 UTC 2025
On Wed, 4 Jun 2025 00:41:03 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Oh, I see. IIRC this is why the shared secrets are bypassing the `address()` method. For shared arenas the caller is supposed to do an acquire/release, and then use shared secrets to get the buffer address, bypassing this check.
>>
>> @minborg recently did some work to change over uses of `DirectBuffer::address` in https://github.com/openjdk/jdk/pull/25324 and https://github.com/openjdk/jdk/pull/25321
>>
>> If ByteBuffers derived from segments with shared arenas no longer work with this patch, that seems like a regression to me.
>
> It could be. More study is clearly needed. This is related to #25531.
I added this test to ensure that memory segments allocated from any Arena could be used with the synchronous channels. It shouldn't be changed.
It may be that further work is required on the asynchronous channels, I will take a closer look.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25631#discussion_r2126079622
More information about the nio-dev
mailing list