Can't get gcc from gcc-toolset-9 to work with -fsanitize=address, while /usr/bin/gcc works fine. # /usr/bin/gcc -o a -fsanitize=address a.c # ./a ================================================================= ==8756==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffdb8730b0 at pc 0x000000400a13 bp 0x7fffdb873010 sp 0x7fffdb873000 READ of size 4 at 0x7fffdb8730b0 thread T0 #0 0x400a12 in main (/root/a+0x400a12) #1 0x7f61b236d872 in __libc_start_main (/lib64/libc.so.6+0x23872) #2 0x40077d in _start (/root/a+0x40077d)Address 0x7fffdb8730b0 is located in stack of thread T0 at offset 128 in frame #0 0x400845 in main (/root/a+0x400845) This frame has 2 object(s): [32, 64) 'a' [96, 128) 'b' <== Memory access at offset 128 overflows this variable# scl enable gcc-toolset-9 bash # /opt/rh/gcc-toolset-9/root/usr/bin/gcc -o a -fsanitize=address a.c /opt/rh/gcc-toolset-9/root/usr/bin/ld: cannot find libasan_preinit.o: No such file or directory /opt/rh/gcc-toolset-9/root/usr/bin/ld: cannot find -lasan collect2: error: ld returned 1 exit status # rpm -qa|grep gcc-toolset|sort gcc-toolset-9-9.0-3.el8.x86_64 gcc-toolset-9-annobin-8.79-2.el8.x86_64 gcc-toolset-9-binutils-2.32-15.el8.x86_64 gcc-toolset-9-dwz-0.12-1.1.el8.x86_64 gcc-toolset-9-dyninst-10.1.0-1.el8.x86_64 gcc-toolset-9-elfutils-0.176-5.el8.x86_64 gcc-toolset-9-elfutils-libelf-0.176-5.el8.x86_64 gcc-toolset-9-elfutils-libs-0.176-5.el8.x86_64 gcc-toolset-9-gcc-9.1.1-2.4.el8.x86_64 gcc-toolset-9-gcc-c++-9.1.1-2.4.el8.x86_64 gcc-toolset-9-gcc-gdb-plugin-9.1.1-2.4.el8.x86_64 gcc-toolset-9-gcc-gfortran-9.1.1-2.4.el8.x86_64 gcc-toolset-9-gdb-8.3-1.el8.x86_64 gcc-toolset-9-libquadmath-devel-9.1.1-2.4.el8.x86_64 gcc-toolset-9-libstdc++-devel-9.1.1-2.4.el8.x86_64 gcc-toolset-9-ltrace-0.7.91-1.el8.x86_64 gcc-toolset-9-make-4.2.1-1.el8.x86_64 gcc-toolset-9-perftools-9.0-3.el8.x86_64 gcc-toolset-9-runtime-9.0-3.el8.x86_64 gcc-toolset-9-strace-5.1-3.el8.x86_64 gcc-toolset-9-systemtap-4.1-4.el8.x86_64 gcc-toolset-9-systemtap-client-4.1-4.el8.x86_64 gcc-toolset-9-systemtap-devel-4.1-4.el8.x86_64 gcc-toolset-9-systemtap-runtime-4.1-4.el8.x86_64 gcc-toolset-9-toolchain-9.0-3.el8.x86_64 gcc-toolset-9-valgrind-3.15.0-9.el8.x86_64 # find /opt/rh/gcc-toolset-9/root/ | grep asan /opt/rh/gcc-toolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/32/libasan.a /opt/rh/gcc-toolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/32/libasan.so /opt/rh/gcc-toolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/32/libasan_preinit.o /opt/rh/gcc-toolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/sanitizer/asan_interface.h and these asan files seems to belong to i686 any any? # yum list gcc\*asan\* lists nothing. Are there any hidden packages or repos somewhere which is needed to get this working?
If you want to compile with -fsanitize=address, you have to install gcc-toolset-9-libasan-devel first. Does installing that package fix the problem?
That would make sense, however it's not available: $ yum install gcc-toolset-9-libasan-devel Updating Subscription Management repositories. Extra Packages for Enterprise Linux Modular 8 - 93 kB/s | 29 kB 00:00 Extra Packages for Enterprise Linux 8 - x86_64 60 kB/s | 25 kB 00:00 Red Hat Enterprise Linux 8 for x86_64 - AppStream ( 6.3 kB/s | 4.5 kB 00:00 Red Hat Enterprise Linux 8 for x86_64 - Supplementa 3.5 kB/s | 3.8 kB 00:01 Red Hat CodeReady Linux Builder for RHEL 8 x86_64 ( 10 kB/s | 4.5 kB 00:00 Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPM 9.3 kB/s | 4.1 kB 00:00 No match for argument: gcc-toolset-9-libasan-devel Error: Unable to find a match: gcc-toolset-9-libasan-devel so I am stuck...
Hmm, that's strange, that package is shipped and available in AppStream. Can you make sure you are using a newer compose than the current one?
I agree it's strange, in fact, it don't make sense at all. I don't know what a compose is this context, can you explain? BTW: exactly the same problem in CentOS 8: http://www.mirrorservice.org/sites/mirror.centos.org/8.1.1911/AppStream/x86_64/os/Packages/ There lots of gcc-toolset-9 packages, however no gcc-toolset-9*asan* packages. I am a bit confused by this.
(In reply to Terje Røsten from comment #4) > I agree it's strange, in fact, it don't make sense at all. > > I don't know what a compose is this context, can you explain? I mean the "version" of the AppStream repo. Newer (RHEL 8.2) have gcc-toolset-9-libasan-devel. So if you can subscribe to a newer repo, you'll problem will be fixed. I think this is usually done using the subscription manager. > BTW: exactly the same problem in CentOS 8: > > http://www.mirrorservice.org/sites/mirror.centos.org/8.1.1911/AppStream/ > x86_64/os/Packages/ > > There lots of gcc-toolset-9 packages, however no gcc-toolset-9*asan* > packages. > > I am a bit confused by this. Ah, not sure about that. I think it just needs time to be updated.
Hmm, looking at the CentOS build I see that gcc-toolset-lib*san* packages are built: https://koji.mbox.centos.org/koji/buildinfo?buildID=6289 however, they are not in repos. http://www.mirrorservice.org/sites/mirror.centos.org/8.1.1911/AppStream/x86_64/os/Packages/ This might be due to: https://bugzilla.redhat.com/show_bug.cgi?id=1722892 libasan5/libubsan1 clash with system libasan/libubsan https://bugzilla.redhat.com/show_bug.cgi?id=1729402 libTsan coming from gcc-toolset-9 leaked through the compose process to RHEL-8.1 BaseOS compose To me is seems like gcc-toolset-*san packages have been filtered from repos due to the two bugs reports above, however that seems like a mistake to me. The value of gcc-toolset-98 is very limited if the toolset is not complete, ASAN is a required tool these days.
(In reply to Terje Røsten from comment #6) > Hmm, looking at the CentOS build I see that gcc-toolset-lib*san* packages > are built: > > https://koji.mbox.centos.org/koji/buildinfo?buildID=6289 > > however, they are not in repos. Sorry. I deal with developing & building the actual bits, but my insight into how the bits are shipped on CentOS is very limited. > http://www.mirrorservice.org/sites/mirror.centos.org/8.1.1911/AppStream/ > x86_64/os/Packages/ > > This might be due to: > > https://bugzilla.redhat.com/show_bug.cgi?id=1722892 > libasan5/libubsan1 clash with system libasan/libubsan > > https://bugzilla.redhat.com/show_bug.cgi?id=1729402 > libTsan coming from gcc-toolset-9 leaked through the compose process to > RHEL-8.1 BaseOS compose > > > To me is seems like gcc-toolset-*san packages have been filtered from repos > due to the two > bugs reports above, however that seems like a mistake to me. > > The value of gcc-toolset-98 is very limited if the toolset is not complete, > ASAN is > a required tool these days. This was just about the shared *san libraries though, they don't have to be shipped in GTS because the system versions are sufficient.
Inviting Jim to comment on the CentOS compose update aspect (see Comment 6). Closing the BZ as it's not a RHEL/DTS problem.