[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1929869B-945B-4DBC-B6CD-0B6C397DA4EA@fb.com>
Date: Fri, 8 Nov 2019 01:17:50 +0000
From: Song Liu <songliubraving@...com>
To: Alexei Starovoitov <ast@...nel.org>
CC: David Miller <davem@...emloft.net>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"x86@...nel.org" <x86@...nel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH v2 bpf-next 07/17] selftests/bpf: Add test for BPF
trampoline
> On Nov 6, 2019, at 9:46 PM, Alexei Starovoitov <ast@...nel.org> wrote:
>
> Add sanity test for BPF trampoline that checks kernel functions
> with up to 6 arguments of different sizes.
>
> Signed-off-by: Alexei Starovoitov <ast@...nel.org>
> ---
> tools/lib/bpf/bpf_helpers.h | 13 +++
> .../selftests/bpf/prog_tests/fentry_test.c | 64 +++++++++++++
> .../testing/selftests/bpf/progs/fentry_test.c | 90 +++++++++++++++++++
> 3 files changed, 167 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/fentry_test.c
> create mode 100644 tools/testing/selftests/bpf/progs/fentry_test.c
>
> diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
> index 0c7d28292898..c63ab1add126 100644
> --- a/tools/lib/bpf/bpf_helpers.h
> +++ b/tools/lib/bpf/bpf_helpers.h
> @@ -44,4 +44,17 @@ enum libbpf_pin_type {
> LIBBPF_PIN_BY_NAME,
> };
>
> +/* The following types should be used by BPF_PROG_TYPE_TRACING program to
> + * access kernel function arguments. BPF trampoline and raw tracepoints
> + * typecast arguments to 'unsigned long long'.
> + */
> +typedef int __attribute__((aligned(8))) ks32;
> +typedef char __attribute__((aligned(8))) ks8;
> +typedef short __attribute__((aligned(8))) ks16;
> +typedef long long __attribute__((aligned(8))) ks64;
> +typedef unsigned int __attribute__((aligned(8))) ku32;
> +typedef unsigned char __attribute__((aligned(8))) ku8;
> +typedef unsigned short __attribute__((aligned(8))) ku16;
> +typedef unsigned long long __attribute__((aligned(8))) ku64;
> +
> #endif
Maybe a separate patch for bpf_helpers.h?
Otherwise,
Acked-by: Song Liu <songliubraving@...com>
Powered by blists - more mailing lists