Skip to content

ppc64le: bpf: bpf_perf_event.h field 'regs' has incomplete type (perf:)

Desnes Nunes requested to merge desnesn/centos-stream-9:rh2113065 into main

BUGZILLA

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2113065

UPSTREAM STATUS

Upstream Status: Patch has been accepted on kernel/git/powerpc/linux.git

CONFLICTS

None

BUILD INFORMATION

Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=46866626

TESTING

The linux/bpf_perf_event.h header can be included normally after using a patched kernel:

================

[root@ltcrain34-lp6 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.1 Beta (Plow)

[root@ltcrain34-lp6 ~]# rpm -qa | grep kernel-headers
kernel-headers-5.14.0-130.el9.ppc64le

[root@ltcrain34-lp6 ~]# gcc temp.c 
In file included from temp.c:2:
/usr/include/linux/bpf_perf_event.h:14:28: error: field ‘regs’ has incomplete type
   14 |         bpf_user_pt_regs_t regs;
      |                            ^~~~

============

[root@ltcrain34-lp6 ~]# rpm -Uvh kernel-headers-5.14.0-138.PATCHED_rhTEMP.el9_0.ppc64le.rpm 
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:kernel-headers-5.14.0-138.PATCHED################################# [ 50%]
Cleaning up / removing...
   2:kernel-headers-5.14.0-130.el9    ################################# [100%]

[root@ltcrain34-lp6 ~]# gcc temp.c 
/usr/bin/ld: /usr/lib/gcc/ppc64le-redhat-linux/11/../../../../lib64/crt1.o:(.data.rel.ro.local+0x8): undefined reference to `main'
collect2: error: ld returned 1 exit status

[root@ltcrain34-lp6 test]# echo "void main(){}" >> temp.c 
[root@ltcrain34-lp6 test]# gcc temp.c
[root@ltcrain34-lp6 test]# ls
a.out  temp.c

================

DESCRIPTION

Fix the uapi usage of the 'bpf_perf_event.h' header, which has been broken since the 'bpf_user_pt_regs_t' exposure that happened after typedefing bpf_user_pt_regs_t to 'struct user_pt_regs'. Currently, no programs can include bpf_user_pt_regs_t on user space.

Signed-off-by: Desnes A. Nunes do Rosario drosario@redhat.com

Edited by Desnes Nunes

Merge request reports