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 2215412 - Performance issue with systemd-coredump and container process linking 2000 shared libraries.
Summary: Performance issue with systemd-coredump and container process linking 2000 sh...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: systemd
Version: 9.2
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: David Tardon
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks: 2222259
TreeView+ depends on / blocked
 
Reported: 2023-06-15 21:01 UTC by Paulo Andrade
Modified: 2023-11-07 11:32 UTC (History)
6 users (show)

Fixed In Version: systemd-252-16.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2222259 (view as bug list)
Environment:
Last Closed: 2023-11-07 08:54:09 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github redhat-plumbers systemd-rhel9 pull 177 0 None open Discard PT_LOAD segment early based on the start address 2023-06-26 13:37:24 UTC
Github systemd systemd pull 28093 0 None Merged elf-util: discard PT_LOAD segment early based on the start address. 2023-06-26 07:55:31 UTC
Github systemd systemd pull 28128 0 None Merged elf-util: check for overflow when computing end of core's PT_LOAD segments 2023-06-26 07:55:44 UTC
Red Hat Issue Tracker RHELPLAN-160017 0 None None None 2023-06-15 21:02:43 UTC
Red Hat Product Errata RHBA-2023:6640 0 None None None 2023-11-07 08:54:41 UTC

Internal Links: 2218039

Description Paulo Andrade 2023-06-15 21:01:23 UTC
Sample reproducer:

"""
cat > lib.c << EOF
int TOTO = 42;
EOF

cat > toto.c << EOF
#include <stdio.h>
int main() {
        printf("started\n");
        int* i = 0;
        *i = 42;
}
EOF


LIBS=""
for i in `seq 2000`; do
        [[ -f liba$i.so ]] || gcc -shared -fPIC -o liba$i.so lib.c -D TOTO=var$i &
        LIBS="${LIBS} -la$i"
done
wait

echo libs built
gcc -o toto toto.c -L. -Wl,-rpath,$(pwd) ${LIBS}
echo running binary
ulimit -c unlimited
time ./toto
"""

  This will trigger systemd-coredump (forking and calling itself sd-parse-elf)
calling elf_gfetdata_rawchunk from elfutils, that does a linear search
(could be better). Then, for every chunk parsed earliersd-parse-elf calls again
elf_getdata_rawchunk, making it of O(N^2) complexity. That is already bad.

  See https://sourceware.org/pipermail/elfutils-devel/2023q2/006225.html for
a sample/proposed patch for systemd-coredump, that would turn the quadratic
performance issue into a linear one. The above link also shows that while
elf_gfetdata_rawchunk could be made better, systemd-coredump is not using it
correctly.

  The possible performance issue in elfutils is https://sourceware.org/git/?p=elfutils.git;a=commitdiff;h=8db849976f07046d27b4217e9ebd08d5623acc4f

Comment 2 Mark Wielaard 2023-06-22 11:54:26 UTC
Note that the systemd upstream patch seems to fix the performance issue by reducing the calls to elfutils libelf elf_getdata_rawchunk.
But there was indeed also a performance issue in elf_getdata_rawchunk. Proposed patch for that is:
https://inbox.sourceware.org/elfutils-devel/3465f95ee22b1ac433f1268f113e3813430be70a.camel@klomp.org/
We can also try to backport that one. The systemd fix seems easier though, and has a bigger performance impact.

Comment 3 Romain Geissler 2023-06-22 23:39:07 UTC
Please note that the systemd patch has a follow up fix here: https://github.com/systemd/systemd/pull/28128

Comment 4 Scott Dodson 2023-06-26 13:59:43 UTC
Requesting 9.2.z

Comment 13 errata-xmlrpc 2023-11-07 08:54:09 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 (systemd bug fix and enhancement update), 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-2023:6640


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