Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1819851

Summary: ASAN support for gcc-devtoolset-9 on el8?
Product: Red Hat Enterprise Linux 8 Reporter: Terje Røsten <terje.rosten>
Component: gcc-toolset-9Assignee: Marek Polacek <mpolacek>
Status: CLOSED CANTFIX QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: ahajkova, fweimer, jakub, jperrin
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-09 14:06:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Terje Røsten 2020-04-01 17:49:51 UTC
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?

Comment 1 Marek Polacek 2020-04-02 20:09:46 UTC
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?

Comment 2 Terje Røsten 2020-04-02 20:23:09 UTC
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...

Comment 3 Marek Polacek 2020-04-02 20:39:13 UTC
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?

Comment 4 Terje Røsten 2020-04-02 21:01:59 UTC
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.

Comment 5 Marek Polacek 2020-04-02 21:10:12 UTC
(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.

Comment 6 Terje Røsten 2020-04-05 11:04:21 UTC
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.

Comment 7 Marek Polacek 2020-04-05 13:57:01 UTC
(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.

Comment 8 Marek Polacek 2020-04-09 14:06:18 UTC
Inviting Jim to comment on the CentOS compose update aspect (see Comment 6).

Closing the BZ as it's not a RHEL/DTS problem.

Comment 9 Red Hat Bugzilla 2023-11-16 04:25:05 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days