On Sun, 23 Jun 2024 03:18:30 GMT, Kim Barrett <kbarr...@openjdk.org> wrote:
>> fastdebug: >> >> >> # A fatal error has been detected by the Java Runtime Environment: >> # >> # Internal Error >> (/home/azul/azul/openjdk-git/src/hotspot/share/runtime/handles.inline.hpp:77), >> pid=878152, tid=878158 >> # assert(_thread->is_in_live_stack((address)this)) failed: not on stack? >> # >> # JRE version: (24.0) (fastdebug build ) >> # Java VM: OpenJDK 64-Bit Server VM (fastdebug >> 24-internal-adhoc.azul.openjdk-git, mixed mode, tiered, compressed oops, >> compressed class ptrs, g1 gc, linux-amd64) >> # Problematic frame: >> # V [libjvm.so+0x1d20658] constantPoolHandle::constantPoolHandle(Thread*, >> ConstantPool*)+0x268 > > make/autoconf/jdk-options.m4 line 448: > >> 446: if test "x$TOOLCHAIN_TYPE" = "xclang"; then >> 447: ASAN_CFLAGS="$ASAN_CFLAGS >> -fsanitize-address-use-after-return=never" >> 448: fi > > I don't think this change should be made. Globally disabling some otherwise > likely useful asan warnings to address what looks like a localized problem > doesn't seem like a good approach to me. > > Also, suppression seems inappropriate since this has the look of a possible > JVM bug. It's hard to tell without more context for the failure, like the full > stack trace and how to reproduce. I understand the problem. You are right there are multiple (2?) ways how to fix it. A reproducer simulating what JDK does: #include <cstdio> struct C { C() { printf("C this=%p sp=%p\n",this,__builtin_frame_address(0)); puts(this>=__builtin_frame_address(0)?"PASS":"FAIL"); } }; int main() { C c; puts("exit"); } The result is: $ gcc -o asan asan.C -Wall -g -fsanitize=address;ASAN_OPTIONS=detect_stack_use_after_return=0 ./asan C this=0x7fffd9dfb720 sp=0x7fffd9dfb6f0 PASS $ gcc -o asan asan.C -Wall -g -fsanitize=address;ASAN_OPTIONS=detect_stack_use_after_return=1 ./asan C this=0x7f08f6009020 sp=0x7ffef58196a0 FAIL The compiler options in this patch just moves the `ASAN_OPTIONS=detect_stack_use_after_return=X` runtime configuration to compile time. https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn The other option is to disable the `is_in_live_stack` assertion in the case of `#ifdef ADDRESS_SANITIZER` (or even detect somehow whether the ASAN option `detect_stack_use_after_return` is active, I did not investigate that). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19843#discussion_r1649878117