Re: [PATCH v2 bpf-next 07/17] selftests/bpf: Add test for BPF trampoline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Nov 6, 2019, at 9:46 PM, Alexei Starovoitov <ast@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
> 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@xxxxxx>




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux