Bug 1722949 - Possible performance regression in libasan with detect_stack_use_after_return=1 (gcc 9.1.1)
Summary: Possible performance regression in libasan with detect_stack_use_after_return...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-21 19:24 UTC by Frantisek Sumsal
Modified: 2019-07-17 11:10 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-07-17 11:10:42 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Frantisek Sumsal 2019-06-21 19:24:45 UTC
Hello,

in systemd we recently (today) noticed[0], that certain CI's started timeouting after upgrade to gcc 9.1.1. After a bit of investigation it seems that the runtime of instrumented binaries with ASan is more than doubled. (The GitHub thread contains claims about the performance issue being present even without sanitizers, but that hasn't been confirmed yet, so please ignore it, for now).


The comparison between gcc 8.3.1 and gcc 9.1.1:

# gcc --version
gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# git clone https://github.com/systemd/systemd
# cd systemd
# CC=gcc CXX=g++ meson build -Db_sanitize=address
# ninja -C build
# cd build

# export ASAN_OPTIONS=detect_stack_use_after_return=1
# time ./test-conf-parser
...
== test_config_parse[13] ==
== test_config_parse[14] ==
/tmp/test-conf-parser.RHRCxb:1: Line too long
== test_config_parse[15] ==
/tmp/test-conf-parser.6U5c9x:1: Continuation line too long

real	0m2.412s
user	0m1.866s
sys	0m0.497s

# time ../test/hwdb-test.sh
Expected warnings
...
tmp/tmp.rilqtBRjht/etc/udev/hwdb.d/10-bad.hwdb:23: Property or empty line expected, got "BAD:8:match at wrong place", ignoring record
/tmp/tmp.rilqtBRjht/etc/udev/hwdb.d/10-bad.hwdb:24: Match expected but got indented property " Z=z", ignoring line
/tmp/tmp.rilqtBRjht/etc/udev/hwdb.d/10-bad.hwdb:26: Property expected, ignoring record with no properties

real	1m35.293s
user	0m42.281s
sys	0m51.394s

# cd ..
# dnf upgrade -y --releasever rawhide --disablerepo fedora-modular,updates-modular --nogpgcheck gcc libasan
...
========================================================================================================================================
 Package                              Architecture                Version                            Repository                    Size
========================================================================================================================================
Upgrading:
 cpp                                  x86_64                      9.1.1-2.fc31                       updates                      9.8 M
 gcc                                  x86_64                      9.1.1-2.fc31                       updates                       23 M
 gcc-c++                              x86_64                      9.1.1-2.fc31                       updates                       12 M
 libasan                              x86_64                      9.1.1-2.fc31                       updates                      453 k
 libgcc                               x86_64                      9.1.1-2.fc31                       updates                       91 k
 libgomp                              x86_64                      9.1.1-2.fc31                       updates                      224 k
 libstdc++                            x86_64                      9.1.1-2.fc31                       updates                      596 k
 libstdc++-devel                      x86_64                      9.1.1-2.fc31                       updates                      2.1 M
 libtool                              x86_64                      2.4.6-30.fc31                      updates                      686 k

Transaction Summary
========================================================================================================================================
Upgrade  9 Packages
...

# rm -fr build
# gcc --version
gcc (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# CC=gcc CXX=g++ meson build -Db_sanitize=address
# ninja -C build
# cd build

# export ASAN_OPTIONS=detect_stack_use_after_return=1
# time ./test-conf-parser
...
== test_config_parse[14] ==
/tmp/test-conf-parser.STRTQN:1: Line too long
== test_config_parse[15] ==
/tmp/test-conf-parser.bZb4j3:1: Continuation line too long

real	0m34.070s
user	0m33.180s
sys	0m0.712s

# time ../test/hwdb-test.sh
Expected warnings
...
tmp/tmp.KBPsuswswG/etc/udev/hwdb.d/10-bad.hwdb:19: Property or empty line expected, got "BAD:7:match at wrong place", ignoring record
/tmp/tmp.KBPsuswswG/etc/udev/hwdb.d/10-bad.hwdb:23: Property or empty line expected, got "BAD:8:match at wrong place", ignoring record
/tmp/tmp.KBPsuswswG/etc/udev/hwdb.d/10-bad.hwdb:24: Match expected but got indented property " Z=z", ignoring line
/tmp/tmp.KBPsuswswG/etc/udev/hwdb.d/10-bad.hwdb:26: Property expected, ignoring record with no properties

real	3m21.901s
user	2m28.122s
sys	0m52.347s


# export ASAN_OPTIONS=detect_stack_use_after_return=0
# time ./test-conf-parser
...
== test_config_parse[14] ==
/tmp/test-conf-parser.BdGLST:1: Line too long
== test_config_parse[15] ==
/tmp/test-conf-parser.8aGdir:1: Continuation line too long

real	0m2.474s
user	0m1.840s
sys	0m0.611s

# time ../test/hwdb-test.sh
Expected warnings
...
/tmp/tmp.fLodo3oD2E/etc/udev/hwdb.d/10-bad.hwdb:19: Property or empty line expected, got "BAD:7:match at wrong place", ignoring record
/tmp/tmp.fLodo3oD2E/etc/udev/hwdb.d/10-bad.hwdb:23: Property or empty line expected, got "BAD:8:match at wrong place", ignoring record
/tmp/tmp.fLodo3oD2E/etc/udev/hwdb.d/10-bad.hwdb:24: Match expected but got indented property " Z=z", ignoring line
/tmp/tmp.fLodo3oD2E/etc/udev/hwdb.d/10-bad.hwdb:26: Property expected, ignoring record with no properties

real	1m12.008s
user	0m24.862s
sys	0m46.284s

---


[0] https://github.com/systemd/systemd/pull/12856#issuecomment-504395847

Comment 1 Frantisek Sumsal 2019-07-08 09:13:57 UTC
Upstream issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91101

Comment 2 Frantisek Sumsal 2019-07-17 11:10:42 UTC
So the issue is actually on systemd's side, there's nothing to fix in gcc - closing.


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