RFR: 8346714: [ASAN] compressedKlass.cpp reported applying non-zero offset to null pointer
SendaoYan
syan at openjdk.org
Fri Dec 20 13:02:15 UTC 2024
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;
-------------
Commit messages:
- 8346714: [ASAN] compressedKlass.cpp reported applying non-zero offset to null pointer
Changes: https://git.openjdk.org/jdk/pull/22848/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22848&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8346714
Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/22848.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22848/head:pull/22848
PR: https://git.openjdk.org/jdk/pull/22848
More information about the hotspot-dev
mailing list