RFR: 8346714: [ASAN] compressedKlass.cpp reported applying non-zero offset to null pointer [v3]
SendaoYan
syan at openjdk.org
Sat Dec 21 02:30:36 UTC 2024
On Fri, 20 Dec 2024 16:08:12 GMT, SendaoYan <syan at openjdk.org> wrote:
>> Hi all,
>> CompressedKlassPointers::sanity_check_after_initialization() src/hotspot/share/oops/compressedKlass.cpp:104:38 reported runtime error: applying non-zero offset 4294967296 to null pointer by clang17 UndefinedBehaviorSanitizer.
>>
>> The _base initial as nullptr in function CompressedKlassPointers::initialize(address addr, size_t len) shows as below. In C/C++, offsetting a null pointer is undefined behavior. This PR do not change the original logic but eliminate the undefined behaviour in code, the risk is low.
>>
>> ```c++
>> address const end = addr + len;
>> if (end <= (address)unscaled_max) {
>> _base = nullptr;
>> _shift = 0;
>
> SendaoYan has updated the pull request incrementally with two additional commits since the last revision:
>
> - Use uintptr_t instead intptr_t
> - cast offset to intptr_t to avoid overflow
GHA report 1 failure:
1. ` linux-x64 / test - Test (tier1)` job report test `gc/shenandoah/TestSmallHeap.java#generational` timed out, the shenandoah-generational interminnet timed out failure has been recorded by [JDK-8345958](https://bugs.openjdk.org/browse/JDK-8345958), it's unrelated to this PR.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22848#issuecomment-2557959921
More information about the hotspot-dev
mailing list