Bug 1582515 - asan test suite fails
Summary: asan test suite fails
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: gcc
Version: 8.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: 8.2
Assignee: Marek Polacek
QA Contact: Václav Kadlčík
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-25 13:07 UTC by Jason Vas Dias
Modified: 2021-11-09 22:57 UTC (History)
6 users (show)

Fixed In Version: gcc-toolset-11-gcc-11.1.1-2.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 18:20:45 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4227 0 None None None 2021-11-09 18:20:59 UTC

Description Jason Vas Dias 2018-05-25 13:07:38 UTC
Description of problem:

I got these test failures trying to build the stock latest
RHEL compiler on my Scientific Linux SL 7.5 system - it 
appears to be an 'upstream' (Red Hat) bug - NO non-SL
RPM binaries were picked up in my $PATH or $LD_LIBRARY_PATH
during build with 'rpmbuild -ba SPECS/gcc.spec', where 
gcc.spec comes from SRPM:
   SRPMS/gcc-4.8.5-28.el7_5.1.src.rpm

After build, cd to:
   BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/gcc/testsuite/g++

  $ grep '^FAIL' g++.log

FAIL: g++.dg/asan/asan_test.C  -O2  AddressSanitizer_SimpleStackTest A[kSize + 31] = 0 execution test
FAIL: g++.dg/asan/asan_test.C  -O2  AddressSanitizer_SimpleStackTest A[kSize + 31] = 0 execution test
FAIL: g++.dg/asan/asan_test.C  -O2  AddressSanitizer_SimpleStackTest A[kSize + 31] = 0 execution test
FAIL: g++.dg/asan/asan_test.C  -O2  AddressSanitizer_SimpleStackTest A[kSize + 31] = 0 execution test
FAIL: g++.dg/fstack-protector-strong.C -std=gnu++98  scan-assembler-times stack_chk_fail 2
FAIL: g++.dg/fstack-protector-strong.C -std=gnu++11  scan-assembler-times stack_chk_fail 2


(I will raise separate bug about  g++.dg/fstack-protector-strong if not
 already there).

Really, the whole reason I install a RHEL image is so that I have
access to a GCC instance where things like asan 'just work' .

I do have gcc 5, 6, 7 and 8 and binutils-2.30
installed under /usr/local/bin, but my $PATH
for the build was '/usr/bin' ONLY , 
and /usr/local was not in any environment variable setting.

All dependencies of GCC RPM are at their latest up-to-date 
defaults on the target system. So why can't I build the
system compiler without these G++ test suite failures ?

Here is the GCC testsuite summary:

                 === gcc Summary for unix//-fstack-protector ===

# of expected passes            100964
# of unexpected failures        51
# of unexpected successes       41
# of expected failures          332
# of unsupported tests          1536

                === gcc Summary ===

# of expected passes            151624
# of unexpected failures        69
# of unexpected successes       82
# of expected failures          548
# of unsupported tests          2103


and for G++:

                === g++ Summary for unix//-fstack-protector ===

# of expected passes            45424
# of unexpected failures        2
# of expected failures          284
# of unsupported tests          645

                === g++ Summary ===

# of expected passes            90850
# of unexpected failures        2
# of expected failures          568
# of unsupported tests          1290




Results for GCC 6 (compiled with $PATH starting with /usr/local/bin
and with /usr/local/lib64 in LD_LIBRARY_PATH) are very slightly 
better if workaround for GCC BZ 85924 permitting -static-libasan
builds not to coredump is in place :

                === gcc Summary ===

# of expected passes            123070
# of unexpected failures        52
# of unexpected successes       21
# of expected failures          326
# of unsupported tests          1773

                === g++ Sumary
# of unexpected failures        2
$ grep '^FAIL' g++.log
FAIL: g++.dg/guality/pr55665.C   -O2  line 23 p == 40
FAIL: g++.dg/guality/pr55665.C   -O3 -g  line 23 p == 40
(I raised GCC bug BZ 85887 about this). 


GCC 7 gets the same G++ test suite failures.

But I'd have expected the stock RHEL compiler to support -fsanitize=address builds properly.

Version-Release number of selected component (if applicable):

gcc-4.8.5-28.el7_5.1

How reproducible:


Steps to Reproduce:
1. Install gcc-4.8.5-28.el7_5.1.srpm & gcc build requires
2. rpmbuild -ba SPECS/gcc.spec
3. cd BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/gcc/testsuite/g++
4. grep '^FAIL' g++.log

Actual results:

Test suite failures.

Expected results:

No test suite failures.

Additional info:

I can attach complete 'rpmbuild -ba 2>&1 | tee $LOG_FILE' output if desired.

Comment 3 Jason Vas Dias 2018-05-25 16:57:56 UTC
CLUE: when I run in the $OBJDIR/gcc/testsuite directory:

$ make check-g++ RUNTESTFLAGS='asan.exp'

it succeeds!

Only when run under rpmbuild, it fails.

Comment 4 Jakub Jelinek 2018-05-25 17:02:10 UTC
That doesn't fail during rpmbuild either.  What fails is:
make check-g++ RUNTESTFLAGS='--target_board=unix/-fstack-protector-strong asan.exp'

Comment 6 Jeff Law 2020-01-21 16:44:01 UTC
If I remember correctly there are cases where stack clash protection interferes with asan tests.  Arguably either stack clash protection should be turned off for those tests or the tests should be skipped with stack clash protection is enabled.

Comment 11 Marek Polacek 2021-01-05 18:14:10 UTC
Seems to work on trunk, gcc-10, and gcc-9:

$ make check-g++ RUNTESTFLAGS='--target_board=unix/-fstack-protector-strong asan.exp'
Making a new config file...
[...]
Running /opt/notnfs/polacek/gcc/gcc/testsuite/g++.dg/asan/asan.exp ...

		=== g++ Summary ===

# of expected passes		3168
# of unsupported tests		168
/opt/notnfs/polacek/trunk/gcc/xg++  version 10.2.1 20210105 (GCC) 

make[1]: Leaving directory '/opt/notnfs/polacek/trunk/gcc'

gcc-8 fails:

$ make check-g++ RUNTESTFLAGS='--target_board=unix/-fstack-protector-strong asan.exp'
Making a new config file...
[...]
Running /opt/notnfs/polacek/gcc/gcc/testsuite/g++.dg/asan/asan.exp ...
FAIL: g++.dg/asan/asan_test.C   -O2  AddressSanitizer_SimpleStackTest A[kSize + 31] = 0 execution test
FAIL: g++.dg/asan/asan_test.C   -O2  AddressSanitizer_SimpleStackTest A[kSize + 31] = 0 execution test
FAIL: g++.dg/asan/asan_test.C   -O2  AddressSanitizer_SimpleStackTest A[kSize + 31] = 0 execution test

		=== g++ Summary ===

# of expected passes		3124
# of unexpected failures	3
# of unsupported tests		162
/opt/notnfs/polacek/trunk/gcc/xg++  version 8.4.1 20210105 (GCC)

Moving to GTS where it's fixed.

Comment 13 Marek Polacek 2021-02-15 17:17:25 UTC
Clearing ITM.

Comment 20 Marek Polacek 2021-05-25 23:21:25 UTC
Should be resolved now.

Comment 26 errata-xmlrpc 2021-11-09 18:20:45 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 (new packages: gcc-toolset-11-gcc), 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/RHBA-2021:4227


Note You need to log in before you can comment on or make changes to this bug.