RFR: 8346866: [ASAN] memoryReserver.cpp reported applying non-zero offset to non-null pointer produced null pointer [v10]

Kim Barrett kbarrett at openjdk.org
Wed Jan 8 04:02:38 UTC 2025


On Wed, 8 Jan 2025 02:19:17 GMT, SendaoYan <syan at openjdk.org> wrote:

>> Hi all,
>> This PR add an extra loop condition check `p2u(attach_point) > stepsize` in function `HeapReserver::Instance::try_reserve_range` to make sure the loop will not wrap around, and make UndefinedBehaviorSanitizer silent. The change do not change the original logic, risk is low.
>> 
>> Additional testing:
>> 
>> - [ ]  jtreg tests(include tier1/2/3 etc., which include tests added by [PR22712](https://github.com/openjdk/jdk/pull/22712)) on linux-x64 with release build
>> - [ ]  jtreg tests(include tier1/2/3 etc., which include tests added by [PR22712](https://github.com/openjdk/jdk/pull/22712)) on linux-x64 with fastdebug build
>> - [ ]  jtreg tests(include tier1/2/3 etc., which include tests added by [PR22712](https://github.com/openjdk/jdk/pull/22712)) on linux-aarch64 with release build
>> - [ ]  jtreg tests(include tier1/2/3 etc., which include tests added by [PR22712](https://github.com/openjdk/jdk/pull/22712)) on linux-aarch64 with fastdebug build
>
> SendaoYan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use size_t insread of uint64_t, use pointer_delta instead of pointer subtraction

Changes requested by kbarrett (Reviewer).

src/hotspot/share/memory/memoryReserver.cpp line 432:

> 430:   assert(is_aligned(lowest_start, attach_point_alignment), "precondition");
> 431: 
> 432:   const size_t attach_range = pointer_delta(highest_start, lowest_start, sizeof(char*));

I think use of `sizeof(char*)` is incorrect, and it should be 1 (or `sizeof(char)`, but that's 1 by definition).
Sorry I didn't notice this earlier.

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

PR Review: https://git.openjdk.org/jdk/pull/22897#pullrequestreview-2535868091
PR Review Comment: https://git.openjdk.org/jdk/pull/22897#discussion_r1906369915


More information about the hotspot-runtime-dev mailing list