RFR: JDK-8298445: Add LeakSanitizer support in HotSpot [v3]

Justin King jcking at openjdk.org
Tue Feb 7 15:32:16 UTC 2023


On Tue, 7 Feb 2023 13:49:55 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> Justin King has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Fix grammatical error
>>    
>>    Signed-off-by: Justin King <jcking at google.com>
>>  - Update based on review and remove restriction on compressed oops and class pointers
>>    
>>    Signed-off-by: Justin King <jcking at google.com>
>
> make/data/asan/asan_default_options.c line 53:
> 
>> 51: ATTRIBUTE_DEFAULT_VISIBILITY ATTRIBUTE_USED const char* __asan_default_options() {
>> 52:   return
>> 53: #ifndef LEAK_SANITIZER
> 
> I'm trying to understand this part. The test for `LEAK_SANITIZER` was put in place in this file, before it was ever generated by the build system..? Was this in anticipation for this PR, or intended for the user to add an extra `-DLEAK_SANITIZER` to the compiler flags manually?
> 
> Also, this patch changes the values for asan, regardless of the state of lsan. Is this required to get the lsan patch working, or is this additional, separate fixes to asan being "smuggled" into this PR? (I don't mind a certain amount of "smuggling", since sometimes it is too tedious to open a separate JBS issue for minor, separate fixes one found out during development), but it is nice to be explicit about it.
> 
> And finally, now that the if statement also has an else, maybe reverse it to an `#ifdef` instead of `#ifndef`..?
> 
> Apart from this, the build changes look good.

It was in anticipation for LSan, yes. ASan by default, in the compilers, enables LSan. I always intending on doing LSan after ASan, so I pre-emptively added the macro check before defining it in the build system.

Since ASan always enables LSan, we change options based on whether it was enabled at configuration to match.

I'll switch to ifdef.

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

PR: https://git.openjdk.org/jdk/pull/12229



More information about the build-dev mailing list