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 2117580 - pahole does not generate VARs for percpu symbols on non-x86_64 arches
Summary: pahole does not generate VARs for percpu symbols on non-x86_64 arches
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: dwarves
Version: 9.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Viktor Malik
QA Contact: Ziqian SUN (Zamir)
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-11 11:40 UTC by Artem Savkov
Modified: 2023-05-09 08:48 UTC (History)
1 user (show)

Fixed In Version: dwarves-1.24-2.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 07:41:02 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-130933 0 None None None 2022-08-11 11:49:09 UTC
Red Hat Product Errata RHBA-2023:2263 0 None None None 2023-05-09 07:41:03 UTC

Description Artem Savkov 2022-08-11 11:40:00 UTC
rhel9's version of pahole doesn't properly generate VARs for percpu symbols on non-x86_64 architectures. Found this while running bpf selftests on aarch64. Looks like the following commit fixes the issue (and can be cherry-picked cleanly onto v1.22)

commit 16a7acaba446612135ba674a51cdda6bfcc34667
Author: Ilya Leoshkevich <iii.com>
Date:   Tue Oct 12 04:26:37 2021 +0200

    btf_encoder: Fix handling of percpu symbols on s390

    pahole does not generate VARs for percpu symbols on s390. A percpu
    symbol definition on a typical x86_64 kernel looks like this:

      [33] .data..percpu     PROGBITS         0000000000000000  01c00000
                                              ^^^^^^^^^^^^^^^^ sh_addr
      LOAD           0x0000000001c00000 0x0000000000000000 0x000000000286f000
                                        ^^^^^^^^^^^^^^^^^^ p_vaddr
     13559: 000000000001ba50     4 OBJECT  LOCAL  DEFAULT   33 cpu_profile_flip
            ^^^^^^^^^^^^^^^^ st_value

    Most importantly, .data..percpu's sh_addr is 0, and this is what pahole
    is currently assuming. However, on s390 this is different:

       [37] .data..percpu     PROGBITS         00000000019cd000  018ce000
                                               ^^^^^^^^^^^^^^^^ sh_addr
      LOAD           0x000000000136e000 0x000000000146d000 0x000000000146d000
                                        ^^^^^^^^^^^^^^^^^^ p_vaddr
    80377: 0000000001ba1440     4 OBJECT  WEAK   DEFAULT   37 cpu_profile_flip
           ^^^^^^^^^^^^^^^^ st_value

    Fix by restructuring the code to always use section-relative offsets for
    symbols. Change the comment to focus on this invariant.

    Signed-off-by: Ilya Leoshkevich <iii.com>
    Cc: Alexei Starovoitov <ast>
    Cc: Andrii Nakryiko <andrii.nakryiko>
    Cc: Daniel Borkmann <daniel>
    Cc: Heiko Carstens <hca.com>
    Cc: Vasily Gorbik <gor.com>
    Cc: bpf.org
    Cc: dwarves.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme>

Without this commit:
    # ./pahole --btf_encode_detached=vml.btf /mnt/testarea/bpf/bpf-next/vmlinux; bpftool btf dump file vml.btf | grep -w VAR | wc -l
    0

With commit applied:
    # ./pahole --btf_encode_detached=vml.btf /mnt/testarea/bpf/bpf-next/vmlinux; bpftool btf dump file vml.btf | grep -w VAR | wc -l
    586

Comment 1 Viktor Malik 2022-12-06 12:09:15 UTC
This was fixed with the 1.24 pahole update.

The above reproducer won't work, though, as it requires a newer bpftool which will get into the buildroot with the bpf 5.19 rebase.

Comment 5 Ziqian SUN (Zamir) 2023-01-03 08:33:09 UTC
The bug is verified as fixed with dwarves-1.24-2.el9.s390x.
[root@ibm-z-503 ~]# pahole --btf_encode_detached=vml.btf /usr/lib/debug/lib/modules/$(uname -r)/vmlinux;  bpftool btf dump file vml.btf | grep -w VAR | wc -l
426
[root@ibm-z-503 ~]# rpm -q bpftool
bpftool-7.0.0-221.el9.s390x

And dwarves-1.24-2.el9 is in the compose.

https://download-node-02.eng.bos.redhat.com/rhel-9/composes/RHEL-9/RHEL-9.2.0-20230102.0/compose/AppStream/x86_64/os/Packages/dwarves-1.24-2.el9.x86_64.rpm

And our bpf testsuite, including dwarves test case, finished without any blocker with the following packages.
bpftrace-0.16.0-1.el9
kernel-5.14.0-221.el9
libbpf-0.8.0-1.el9
bcc-0.25.0-1.el9
https://beaker.engineering.redhat.com/matrix/?toggle_nacks_on=on&job_ids=7385834

All the failures in the above job have been reported into separated bugs.

Comment 7 errata-xmlrpc 2023-05-09 07:41:02 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 (dwarves 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:2263


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