RFR: JDK-8327971: Multiple ASAN errors reported for metaspace [v3]

Guoxiong Li gli at openjdk.org
Wed Mar 13 09:18:14 UTC 2024


On Wed, 13 Mar 2024 08:09:14 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/share/sanitizers/address.hpp line 65:
>> 
>>> 63: #define ASAN_ONLY(code)
>>> 64: #define NOT_ASAN(code)  code
>>> 65: #define ASAN_POISON_MEMORY_REGION(addr, size) \
>> 
>> This preprocessing directive is for the macros `ASAN_POISON_MEMORY_REGION` and `ASAN_UNPOISON_MEMORY_REGION`. You can read the comment before `#ifdef ADDRESS_SANITIZER`. So it is good to place your code at another macro `#ifdef ADDRESS_SANITIZER`.
>
> Okay, done.

> You can read the comment before `#ifdef ADDRESS_SANITIZER`. So it is good to place your code at another macro `#ifdef ADDRESS_SANITIZER`.

The comment I meant is shown below, so I suggested that you put your code at another new macro.


// ASAN_POISON_MEMORY_REGION()/ASAN_UNPOISON_MEMORY_REGION()
//
// Poisons/unpoisons the specified memory region. When ASan is available this is the macro of the
// same name from <sanitizer/asan_interface.h>. When ASan is not available this macro is a NOOP
// which preserves the arguments, ensuring they still compile, but ensures they are stripped due to
// being unreachable. This helps ensure developers do not accidently break ASan builds.


But from the newest code, which uses only `INCLUDE_ASAN` instead of `ASAN_ONLY` and `NOT_ASAN`, I think you can use the exiting `ADDRESS_SANITIZER` instead of adding `INCLUDE_ASAN`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18230#discussion_r1522815703


More information about the hotspot-runtime-dev mailing list