Integrated: 8349465: [UBSAN] test_os_reserve_between.cpp reported applying non-zero offset to null pointer
SendaoYan
syan at openjdk.org
Thu Feb 6 15:04:14 UTC 2025
On Wed, 5 Feb 2025 12:29:23 GMT, SendaoYan <syan at openjdk.org> wrote:
> Hi all,
> Test function `os_attempt_reserve_memory_between_combos_vm_Test::TestBody()` in "test/hotspot/gtest/runtime/test_os_reserve_between.cpp" file reported "applying non-zero offset 4096 to null pointer" by UndefinedBehaviorSanitizer. The var `min` cast from 0 to pointer and then apply non-zero offset `range_size` is undefined behavior.
>
> This PR cast pointer `min` to uintptr_t before add the offset `range_size`, and the cast back to pointer. This solution similar to [JDK-8346714](https://github.com/openjdk/jdk/pull/22848). This PR do not change the original logic but eliminate the undefined behaviour in code.
>
> Change has been verified locally, test-fix only, no risk.
This pull request has now been integrated.
Changeset: 3fbae32d
Author: SendaoYan <syan at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/3fbae32d0a9dbe612d4170e135a813c114fdcec2
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
8349465: [UBSAN] test_os_reserve_between.cpp reported applying non-zero offset to null pointer
Reviewed-by: mdoerr, amitkumar
-------------
PR: https://git.openjdk.org/jdk/pull/23462
More information about the hotspot-runtime-dev
mailing list