RFR: 8345569: [ubsan] filemap.cpp:2215:47: runtime error: applying non-zero offset 34358689792 to null pointer

Matthias Baesken mbaesken at openjdk.org
Mon Dec 9 08:19:43 UTC 2024


On Mon, 9 Dec 2024 02:15:43 GMT, David Holmes <dholmes at openjdk.org> wrote:

> > error: applying non-zero offset to non-null pointer 0x000080000000 produced null pointer
> 
> So that sounds like signed arithmetic is being performed instead of unsigned.

I think the virtualspace.cpp related issue came in just recently .  Earlier last week I did not see this issue.

> src/hotspot/share/cds/filemap.cpp line 2248:
> 
>> 2246:     // the value P can remain 0x1200. The decoded address = (0x4000 + (0x1200 << 0)) = 0x5200,
>> 2247:     // which is the runtime location of the referenced object.
>> 2248:     return /*runtime*/ (address)((uintptr_t)CompressedOops::base() + r->mapping_offset());
> 
> If `base()` can return 0 (nullptr) then how does the casting help with the warning?

I think the addition on uintptr_t is defined in C++ while the addition on nullptr is not.
That's why the ubsan warning/error goes away.

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

PR Comment: https://git.openjdk.org/jdk/pull/22603#issuecomment-2527230088
PR Review Comment: https://git.openjdk.org/jdk/pull/22603#discussion_r1875545832


More information about the hotspot-runtime-dev mailing list