From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BF35B3846403; Thu, 6 May 2021 11:59:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF35B3846403 From: "florin.iucha at amd dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/100439] stack overflow running ubsan Date: Thu, 06 May 2021 11:59:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 11.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: florin.iucha at amd dot com X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 11:59:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100439 --- Comment #2 from Florin Iucha --- This is for regular x86-64; we're using a cross-compiler sysroot to avoid dependency on system libraries and be able to run the binary on different L= inux distributions. I can't reproduce the problem on a "hello, world" C++ program, but I was ab= le to reproduce it on a minimal Google test: --8< --8< --8< --8< --8< --8< --8< --8< --8< --8< --8< --8<=20 #include #include TEST(Hello, World) { ASSERT_EQ(43, std::stoi("42")); } --8< --8< --8< --8< --8< --8< --8< --8< --8< --8< --8< --8<=20 Built using: /opt/tng-gcc11-glibc-linux5.4/bin/x86_64-tng-linux-gnu-g++ -m64 -g -std=3Dc= ++20 -fsanitize=3Dundefined -fno-omit-frame-pointer -o hello.o -c hello.cpp /opt/tng-gcc11-glibc-linux5.4/bin/x86_64-tng-linux-gnu-g++ -o hello -Wl,-rp= ath -Wl,/opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib -Wl,-dynamic-linker /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/ld-linux-x86= -64.so.2 -fsanitize=3Dundefined hello.o /opt/tng-gcc11-glibc-linux5.4/bin/x86_64-tng-linux-gnu-g++ -m64 -g -std=3Dc= ++20 -fsanitize=3Dundefined -fno-omit-frame-pointer -o test_hello.o -I/home/fiucha/.conan/data/gtest/20201109/amd/tng/package/150f650d359c1c443= c3bb8ac2ffee0bdec61d239/include -c test_hello.cpp /opt/tng-gcc11-glibc-linux5.4/bin/x86_64-tng-linux-gnu-g++ -o test_hello -Wl,-rpath -Wl,/opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/l= ib -Wl,-dynamic-linker /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/ld-linux-x86= -64.so.2 -fsanitize=3Dundefined test_hello.o /home/fiucha/.conan/data/gtest/20201109/amd/tng/package/150f650d359c1c443c3= bb8ac2ffee0bdec61d239/lib/libgmock_maind.a /home/fiucha/.conan/data/gtest/20201109/amd/tng/package/150f650d359c1c443c3= bb8ac2ffee0bdec61d239/lib/libgmockd.a /home/fiucha/.conan/data/gtest/20201109/amd/tng/package/150f650d359c1c443c3= bb8ac2ffee0bdec61d239/lib/libgtestd.a -lpthread ./test_hello zsh: segmentation fault (core dumped) ./test_hello Running under gdb: (gdb) b __dynamic_cast Breakpoint 1 at 0x40a620 (gdb) run Breakpoint 1, 0x00007ffff7ea92fd in __dynamic_cast () from /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/libstdc++.so= .6 (gdb) bt #0 0x00007ffff7ea92fd in __dynamic_cast () from /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/libstdc++.so= .6 #1 0x00007ffff7eef6ff in bool std::has_facet >(std::locale const&) () from /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/libstdc++.so= .6 #2 0x00007ffff7ee6977 in std::basic_ios >::_M_cache_locale(std::locale const&) () from /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/libstdc++.so= .6 #3 0x00007ffff7ee6c01 in std::basic_ios >::init(std::basic_streambuf >*) () from /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/libstdc++.so= .6 #4 0x00007ffff7ef6c6d in std::basic_ostream >::basic_ostream(std::basic_streambuf >*) () from /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/libstdc++.so= .6 #5 0x00007ffff7eb335b in std::ios_base::Init::Init() () from /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/libstdc++.so= .6 #6 0x000000000040af7b in __static_initialization_and_destruction_0 (__initialize_p=3D1, __priority=3D65535) at /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/include/c++/11.1.1/iostr= eam:74 #7 0x000000000040b1d3 in _GLOBAL__sub_I__ZN16Hello_World_Test10test_info_E= () at test_hello.cpp:8 #8 0x000000000053c5f5 in __libc_csu_init (argc=3Dargc@entry=3D1, argv=3Dargv@entry=3D0x7fffffffe8b8, envp=3D0x7fffffffe8c8) at elf-init.c:89 #9 0x00007ffff71aa76d in __libc_start_main (main=3D0x40f8b9 , argc=3D1, argv=3D0x7fffffffe8b8, init=3D0x53c5b0 <__libc_csu_init>, fini=3D, rtld_fini=3D, stack_end=3D0x7fff= ffffe8a8) at ../csu/libc-start.c:279 #10 0x000000000040ac4a in _start () at ../sysdeps/x86_64/start.S:120 (gdb) ignore 1 9999999 Will ignore next 9999999 crossings of breakpoint 1. (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0x00007ffff736ae75 in ?? () from /opt/tng-gcc11-glibc-linux5.4/x86_64-tng-linux-gnu/sysroot/lib/libubsan.so.1 (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x00007ffff7ea92fd <__dynamic_cast> breakpoint already hit 7488 times ignore next 9992512 hits=