[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ3-oA_h2YbpgUXnLoCL_6dj881rryizcUP=Kxf512-9A@mail.gmail.com>
Date: Thu, 11 Jul 2019 17:49:21 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Ilya Leoshkevich <iii@...ux.ibm.com>
Cc: bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Y Song <ys114321@...il.com>,
Daniel Borkmann <daniel@...earbox.net>,
Stanislav Fomichev <sdf@...ichev.me>,
"David S. Miller" <davem@...emloft.net>,
Alexei Starovoitov <ast@...nel.org>
Subject: Re: [PATCH v4 bpf-next 3/4] selftests/bpf: make PT_REGS_* work in userspace
On Thu, Jul 11, 2019 at 7:31 AM Ilya Leoshkevich <iii@...ux.ibm.com> wrote:
>
> Right now, on certain architectures, these macros are usable only with
> kernel headers. This patch makes it possible to use them with userspace
> headers and, as a consequence, not only in BPF samples, but also in BPF
> selftests.
>
> On s390, provide the forward declaration of struct pt_regs and cast it
> to user_pt_regs in PT_REGS_* macros. This is necessary, because instead
> of the full struct pt_regs, s390 exposes only its first member
> user_pt_regs to userspace, and bpf_helpers.h is used with both userspace
> (in selftests) and kernel (in samples) headers. It was added in commit
> 466698e654e8 ("s390/bpf: correct broken uapi for
> BPF_PROG_TYPE_PERF_EVENT program type").
>
> Ditto on arm64.
>
> On x86, provide userspace versions of PT_REGS_* macros. Unlike s390 and
> arm64, x86 provides struct pt_regs to both userspace and kernel, however,
> with different member names.
>
> Signed-off-by: Ilya Leoshkevich <iii@...ux.ibm.com>
> ---
This is great, thanks!
Acked-by: Andrii Nakryiko <andriin@...com>
> tools/testing/selftests/bpf/bpf_helpers.h | 75 +++++++++++++++++------
> 1 file changed, 55 insertions(+), 20 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
> index 73071a94769a..27090d94afb6 100644
[...]
Powered by blists - more mailing lists