RFR: 8331731: ubsan: relocInfo.cpp:155:30: runtime error: applying non-zero offset 18446744073709551614 to null pointer [v2]
Stefan Karlsson
stefank at openjdk.org
Thu May 30 16:17:03 UTC 2024
On Wed, 29 May 2024 10:04:14 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
>> When running on macOS with ubsan enabled, we see some issues in relocInfo (hpp and cpp); those already occur in the build quite early.
>>
>> /jdk/src/hotspot/share/code/relocInfo.cpp:155:30: runtime error: applying non-zero offset 18446744073709551614 to null pointer
>>
>> Similar happens when we add to the _current pointer
>> _current++;
>> this gives :
>> relocInfo.hpp:606:13: runtime error: applying non-zero offset to non-null pointer 0xfffffffffffffffe produced null pointer
>>
>> Seems the pointer subtraction/addition worked so far, so it might be an option to disable ubsan for those 2 functions.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
>
> use template functions
Oh, and as it doesn't seem to have been clear from my earlier comments: I don't strongly oppose that you fix it this way you do in the RelocIterator, since I have very little interaction with that code.
The comment was more that I would prefer if we take a case-by-case approach when we look at other parts of HotSpot with similar problems and really think what the correct solution would be, and that we don't too quickly start to grab for the `add/sub_to_ptr` solution. Putting these functions in globalDefinitions makes it all too easy to just grab for these functions when we try to solve similar problems, IMHO. That's my 2c. I'm not blocking this patch, as long as we get somewhat decent names.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19424#issuecomment-2140118108
More information about the hotspot-compiler-dev
mailing list