Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1709720

Summary: binutils fails to compile with -fsanitize=address
Product: Red Hat Developer Toolset Reporter: Miloš Prchlík <mprchlik>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED ERRATA QA Contact: Miloš Prchlík <mprchlik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: DTS 8.1 RHEL 7CC: ahajkova, bgollahe, fweimer, law, mcermak, mnewsome, mpolacek, nickc, ohudlick, qe-baseos-tools-bugs, tborcin
Target Milestone: alpha   
Target Release: 9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: binutils-2.32-6.el7, binutils-2.32-6.el6 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 1678323 Environment:
Last Closed: 2019-12-10 07:50:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miloš Prchlík 2019-05-14 08:06:07 UTC
This issue applies to DTS binutils build as well, cloning the RHEL8 bug to include Nick's comments, especially the upstream report & the patch.


With devtoolset-8-binutils-2.30-54:

CFLAGS='-m32 -fstack-protector-all -fsanitize=address' CXXFLAGS='-m32 -fstack-protector-all -fsanitize=address' ./configure --disable-shared --disable-gdb --disable-libdecnumber --disable-readline --disable-sim && make all-binutils

ends with:

gcc -DHAVE_CONFIG_H -I.  -I. -I. -I../bfd -I./config -I./../include -I./.. -I./../bfd -DLOCALEDIR="\"/usr/local/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I./../zlib -m32 -fstack-protector-all -fsanitize=address -MT atof-ieee.o -MD -MP -MF .deps/atof-ieee.Tpo -c -o atof-ieee.o `test -f 'config/atof-ieee.c' || echo './'`config/atof-ieee.c
mv -f .deps/atof-ieee.Tpo .deps/atof-ieee.Po
/bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I./../zlib -m32 -fstack-protector-all -fsanitize=address   -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o  ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I./../zlib -m32 -fstack-protector-all -fsanitize=address -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o  ../opcodes/.libs/libopcodes.a -L/root/rpmbuild/BUILD/binutils-2.30/zlib /root/rpmbuild/BUILD/binutils-2.30/bfd/.libs/libbfd.a ../bfd/.libs/libbfd.a -lz ../libiberty/libiberty.a
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: /root/rpmbuild/BUILD/binutils-2.30/bfd/.libs/libbfd.a(plugin.o): undefined reference to symbol 'dlsym@@GLIBC_2.0'
//lib/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:800: as-new] Error 1
make[4]: Leaving directory '/root/rpmbuild/BUILD/binutils-2.30/gas'
make[3]: *** [Makefile:2288: all-recursive] Error 1
make[3]: Leaving directory '/root/rpmbuild/BUILD/binutils-2.30/gas'
make[2]: *** [Makefile:730: all] Error 2
make[2]: Leaving directory '/root/rpmbuild/BUILD/binutils-2.30/gas'
make[1]: *** [Makefile:4864: all-gas] Error 2
make[1]: Leaving directory '/root/rpmbuild/BUILD/binutils-2.30'


I'm using this build to verify some (not major) CVEs. My two cents - not that important to cause a respin, but nice to get a fix in the next DTS round. Feel free to postpone.




+++ This bug was initially created as a clone of Bug #1678323 +++

Description of problem:
binutils fails to compile with CFLAGS='-fsanitize=address -ggdb' CXXFLAGS='-fsanitize=address -ggdb' LDFLAGS='-fsanitize=address'

Version-Release number of selected component (if applicable):
binutils-2.30-49.el8.x86_64

How reproducible:
for binutils-2.30-49.el8.src.rpm

Steps to Reproduce:
1. CFLAGS='-fsanitize=address -ggdb' CXXFLAGS='-fsanitize=address -ggdb' LDFLAGS='-fsanitize=address' ./configure
2. LSAN_OPTIONS=detect_leaks=0 make all-binutils

Actual results:
/usr/bin/ld: /root/rpmbuild/BUILD/binutils-2.30/bfd/.libs/libbfd.a(plugin.o): undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
//usr/lib64/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:800: as-new] Error 1

--- Additional comment from Nick Clifton on 2019-02-18 17:19:41 CET ---

Hi Alexandra,

  This is basically a duplicate of https://sourceware.org/bugzilla/show_bug.cgi?id=22318.

  I am pushing fixing this problem out to 8.1.0 since the binutils are not normally built
  with sanitization enabled.

Cheers
  Nick

--- Additional comment from Nick Clifton on 2019-02-18 17:21 CET ---

This is the patch used in the GNU Binutils sources to fix this problem.

Note - in order for this patch to be effective it is necessary to configure the binutils with --enable-plugins option.

Comment 1 Nick Clifton 2019-05-14 16:37:50 UTC
Not important enough to warrant a z-stream release or holding up the 8.1 release,
so moving out to DTS 9.0.

Comment 2 Nick Clifton 2019-06-19 09:48:37 UTC
Fixed in: binutils-2.32-6.el7, binutils-2.32-6.el6

Comment 4 Miloš Prchlík 2019-11-05 13:35:09 UTC
Verified with devtoolset-9-binutils-2.32-13.el7.

Comment 6 errata-xmlrpc 2019-12-10 07:50:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2019:4139