RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v9]
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Nov 22 09:42:23 UTC 2022
On Tue, 22 Nov 2022 09:32:32 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Rework Acquisition
>
> src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java line 590:
>
>> 588: int pos)
>> 589: throws IOException {
>> 590: try (var guard = NIO_ACCESS.acquireScope(bb)) {
>
> Why was the old code not using reachability fences? Bug or feature?
I see that there's a subsequent buffer call if `n > 0`, so that's probably why the fence was skipped? (I also assume that the code calling this method will access the buffer before/after, so reachability is never truly an issue - but for session-backed buffers this needs fixing).
Also, stepping back, I note how, if `receive0` was a native call using Linker, perhaps we wouldn't need all this manual address computation - we'd just get a memory segment slice from the buffer and pass that to the handle (which will perform the correct liveness check). E.g. maybe a better long term solution would be to panama-ize this code?
-------------
PR: https://git.openjdk.org/jdk/pull/11260
More information about the security-dev
mailing list