Cover more cases where JDK creates `DirectByteBuffer`
Opened this issue · 0 comments
Problem solved by the enhancement
Currently only ByteBuffer#allocateDirect
is intercepted. However, there are more cases where the JDK creates a DirectByteBuffer
(and more importantly, where ByteBuffer.isDirect()
returns true). For example memory mapped files.
Obtaining the address from these buffers and then using Unsafe
will currently most likely be erroneously reported as invalid memory access by the sanitizer.
Enhancement description
Before adjusting the sanitizer implementation, first check if using Unsafe
with these buffers actually works properly.
Then consider adding interceptors for the other DirectByteBuffer
constructors, respectively for the other methods calling them.
Alternatives / workarounds
Don't handle these other cases, assuming that they are not common enough, and intercepting the internal DirectByteBuffer
constructors might not be worth the effort and might be too error-prone.