From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 466D23858D20; Thu, 28 Sep 2023 06:14:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 466D23858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695881684; bh=TPyNhf0uP8MnWUEs6QwAfS929qeOqzyoYyWZCwkrASo=; h=From:To:Subject:Date:From; b=xd2ZorqsSWLyn+aes3E0cJGJO/Ourop4fZ2GS7lN2E6bP59Xj04J/PEd9R8ztv4EO VZjkl5M7EYvwFpQ4MS47rcZlrwhVIDgPKP8V34M+AzDLkEk/F16HbPEdHEXOeU/v3U D+1FGQ1OYlLSlr0lX0Yzkg2Q18Zh4l8S6j3hxg50= From: "akhilesh.k at samsung dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/111620] New: [RISC-V]fsanitize is not working with cpp Date: Thu, 28 Sep 2023 06:14:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: akhilesh.k at samsung dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111620 Bug ID: 111620 Summary: [RISC-V]fsanitize is not working with cpp Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: akhilesh.k at samsung dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxi= n at gcc dot gnu.org Target Milestone: --- Hello=20 During ASAN verification I observed most of the ASAN is not working for cpp sharing logs and sample code.=20 user@starfive:~/akhilesh/asan$ g++ print.cpp -fsanitize=3Daddress user@starfive:~/akhilesh/asan$ ./a.out=20 AddressSanitizer:DEADLYSIGNAL =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D17785=3D=3DERROR: AddressSanitizer: SEGV on unknown address 0x00081f4= 68e44 (pc 0x002ae2626c74 bp 0x003ffa3472e0 sp 0x003ffa347210 T0) =3D=3D17785=3D=3DThe signal is caused by a WRITE memory access. #0 0x2ae2626c74 in main (/home/user/akhilesh/asan/a.out+0xc74) #1 0x3fbdac4b02 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #2 0x3fbdac4baa in __libc_start_main_impl csu/libc-start.c:381 #3 0x2ae2626b6e in _start (/home/user/akhilesh/asan/a.out+0xb6e) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/home/user/akhilesh/asan/a.out+0xc74) in m= ain =3D=3D17785=3D=3DABORTING user@starfive:~/akhilesh/asan$ cat print.cpp #include using namespace std; int main() { int arr[10]; arr[5]=3D8; cout< using namespace std; int main() { cout << "Hello"; return 0; } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= run time logs=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ser@starfive:~/akhilesh/asan$ g++ -g use_after_free.cpp -fsanitize=3Daddres= s=20 user@starfive:~/akhilesh/asan$ ./a.out=20 AddressSanitizer: CHECK failed: asan_poisoning.cpp:36 "((AddrIsInMem(addr))= ) !=3D (0)" (0x0, 0x0) (tid=3D17449) #0 0x3fb771805c in CheckUnwind ../../../../src/libsanitizer/asan/asan_rtl.cpp:67 #1 0x3fb7730a3a in __sanitizer::CheckFailed(char const*, int, char cons= t*, unsigned long long, unsigned long long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:86 #2 0x3fb7711dca in __asan::PoisonShadow(unsigned long, unsigned long, unsigned char) ../../../../src/libsanitizer/asan/asan_poisoning.cpp:36 #3 0x3fb76a2e36 in __asan::AsanMapUnmapCallback::OnMap(unsigned long, unsigned long) const ../../../../src/libsanitizer/asan/asan_allocator.cpp:2= 46 #4 0x3fb76a2e36 in __sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpa= ceView> >::MapWithCallback(unsigned long, unsigned long, char const*) ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator_primary64= .h:717 #5 0x3fb76a2e36 in __sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpa= ceView> >::MapWithCallback(unsigned long, unsigned long, char const*) ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator_primary64= .h:709 #6 0x3fb76a2e36 in __sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpa= ceView> >::PopulateFreeArray(__sanitizer::AllocatorStats*, unsigned long, __sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpa= ceView> >::RegionInfo*, unsigned long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator_primary64= .h:798 #7 0x3fb76a3246 in __sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpa= ceView> >::GetFromAllocator(__sanitizer::AllocatorStats*, unsigned long, unsigned i= nt*, unsigned long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator_primary64= .h:220 #8 0x3fb76a32bc in __sanitizer::SizeClassAllocator64LocalCache<__sanitizer::SizeClassAllocator= 64<__asan::AP64<__sanitizer::LocalAddressSpaceView> > >::Refill(__sanitizer::SizeClassAllocator64LocalCache<__sanitizer::SizeClas= sAllocator64<__asan::AP64<__sanitizer::LocalAddressSpaceView> > >::PerClass*, __sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::LocalAddressSpa= ceView> >*, unsigned long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator_local_cac= he.h:103 #9 0x3fb76a353c in __sanitizer::SizeClassAllocator64LocalCache<__sanitizer::SizeClassAllocator= 64<__asan::AP64<__sanitizer::LocalAddressSpaceView> > >::Allocate(__sanitizer::SizeClassAllocator64<__asan::AP64<__sanitizer::Loc= alAddressSpaceView> >*, unsigned long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator_local_cac= he.h:39 #10 0x3fb76a353c in __sanitizer::CombinedAllocator<__sanitizer::SizeClassAllocator64<__asan::AP= 64<__sanitizer::LocalAddressSpaceView> >, __sanitizer::LargeMmapAllocatorPtrArrayDynamic>::Allocate(__sanitizer::Size= ClassAllocator64LocalCache<__sanitizer::SizeClassAllocator64<__asan::AP64<_= _sanitizer::LocalAddressSpaceView> > >*, unsigned long, unsigned long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator_combined.= h:69 #11 0x3fb76a370a in __asan::Allocator::Allocate(unsigned long, unsigned long, __sanitizer::BufferedStackTrace*, __asan::AllocType, bool) ../../../../src/libsanitizer/asan/asan_allocator.cpp:536 #12 0x3fb76a101a in __asan::asan_malloc(unsigned long, __sanitizer::BufferedStackTrace*) ../../../../src/libsanitizer/asan/asan_allocator.cpp:964 #13 0x3fb771002c in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:70 #14 0x3fb734a3a8 in __GI__IO_file_doallocate libio/filedoalloc.c:101 user@starfive:~/akhilesh/asan$=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3Dgcc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D user@starfive:~/akhilesh/asan$ gcc -v=20 Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/usr/lib/gcc/riscv64-linux-gnu/12/lto-wrapper Target: riscv64-linux-gnu Configured with: ../src/configure -v --with-pkgversion=3D'Debian 12.2.0-10' --with-bugurl=3Dfile:///usr/share/doc/gcc-12/README.Bugs --enable-languages=3Dc,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=3D/usr --with-gcc-major-version-only --program-suffix=3D-12 --program-prefix=3Driscv64-linux-gnu- --enable-shared --enable-linker-build= -id --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dposix --libdir=3D/usr/lib --enable-nls --enable-clocale=3Dgnu --enable-libstdcxx-= debug --enable-libstdcxx-time=3Dyes --with-default-libstdcxx-abi=3Dnew --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=3Drelease --with-target-system-zlib=3Dauto --enable-objc-gc=3Dauto --enable-multiarch --disable-werror --disable-multilib --with-arch=3Drv64gc --with-abi=3Dlp64d --enable-checking=3Drelease --build=3Driscv64-linux-gnu --host=3Driscv64-li= nux-gnu --target=3Driscv64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.0 (Debian 12.2.0-10)=20 user@starfive:~/akhilesh/asan$=