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 2065638 - libbpf SEGFAULT with fully stripped BPF object
Summary: libbpf SEGFAULT with fully stripped BPF object
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libbpf
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Viktor Malik
QA Contact: Zhiqian Guan
URL:
Whiteboard:
Depends On: 2069045
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-18 11:43 UTC by Felix Maurer
Modified: 2022-11-15 13:17 UTC (History)
2 users (show)

Fixed In Version: libbpf-0.6.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 11:21:16 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-116103 0 None None None 2022-03-18 11:45:23 UTC
Red Hat Product Errata RHBA-2022:8364 0 None None None 2022-11-15 11:21:18 UTC

Description Felix Maurer 2022-03-18 11:43:07 UTC
Description of problem:
Trying to load an BPF object, which was fully stripped, using ip/libbpf fails with a SEGFAULT.


Version-Release number of selected component (if applicable):
iproute-5.15.0-2.el9.x86_64
libbpf-0.5.0-4.el9.x86_64
kernel-5.14.0-72.el9.x86_64


How reproducible:
Always


Steps to Reproduce:
This example is based on a BPF selftest failure. The behavior is very likely to occur in other places as well.
1. # cd /usr/libexec/kselftests/bpf
2. # ip link add dev veth0 type veth peer name veth1
3. # strip sample_map_ret0.o
4. # ip link set dev veth0 xdp obj sample_map_ret0.o sec .text verbose


Actual results:
libbpf: loading sample_map_ret0.o
libbpf: elf: section(1) .text, size 176, link 0, flags 6, type=1
Segmentation fault (core dumped)


Expected results:
Loading a fully stripped BPF file can not work but it should fail with a friendly error message.

Comment 1 Viktor Malik 2022-04-08 06:47:39 UTC
Requires upstream commit:

    03e601f48b2 libbpf: Don't crash on object files with no symbol tables

which should be pulled in as a part of BPF 5.16 rebase.

Comment 2 Viktor Malik 2022-07-18 08:34:23 UTC
libbpf 0.6.0 should contain the commit mentioned above

Comment 3 Zhiqian Guan 2022-07-20 03:43:29 UTC
Tested on kernel 5.14.0-130.el9.x86_64
[root@netqe12 ~]# cd /usr/libexec/kselftests/bpf
[root@netqe12 bpf]# ip link add dev veth0 type veth peer name veth1
[root@netqe12 bpf]# strip sample_map_ret0.o
[root@netqe12 bpf]# ip link set dev veth0 xdp obj sample_map_ret0.o sec .text verbose
libbpf: loading sample_map_ret0.o
libbpf: elf: couldn't find symbol table in sample_map_ret0.o, stripped object file?
ERROR: opening BPF object file failed

The error msg looks more friendly. 

Since the patch has already been merged by bpf update, so mark this as testOnly.

Comment 10 Zhiqian Guan 2022-07-20 14:16:22 UTC
Based on comment3, move this to VERIFIED

Comment 12 errata-xmlrpc 2022-11-15 11:21:16 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 (libbpf 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-2022:8364


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