Skip to content

Commit

Permalink
powerpc/bpf: Fix broken uapi for BPF_PROG_TYPE_PERF_EVENT
Browse files Browse the repository at this point in the history
Now that there are different variants of pt_regs for userspace and
kernel, the uapi for the BPF_PROG_TYPE_PERF_EVENT program type must be
changed by exporting the user_pt_regs structure instead of the pt_regs
structure that is in-kernel only.

Fixes: 002af93 ("powerpc: Split user/kernel definitions of struct pt_regs")
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Sandipan Das authored and Michael Ellerman committed Dec 7, 2018
1 parent e41b93a commit a6460b0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions arch/powerpc/include/asm/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <asm/ptrace.h>
#include <asm/reg.h>

#define perf_arch_bpf_user_pt_regs(regs) &regs->user_regs

/*
* Overload regs->result to specify whether we should use the MSR (result
* is zero) or the SIAR (result is non zero).
Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

generic-y += bpf_perf_event.h
generic-y += param.h
generic-y += poll.h
generic-y += resource.h
Expand Down
9 changes: 9 additions & 0 deletions arch/powerpc/include/uapi/asm/bpf_perf_event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
#define _UAPI__ASM_BPF_PERF_EVENT_H__

#include <asm/ptrace.h>

typedef struct user_pt_regs bpf_user_pt_regs_t;

#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */

0 comments on commit a6460b0

Please sign in to comment.