[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190725232633.zt6fxixq72xqwwmz@ast-mbp>
Date: Thu, 25 Jul 2019 16:26:34 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Andrii Nakryiko <andriin@...com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, ast@...com,
daniel@...earbox.net, yhs@...com, andrii.nakryiko@...il.com,
kernel-team@...com
Subject: Re: [PATCH bpf-next 06/10] selftests/bpf: add CO-RE relocs array
tests
On Wed, Jul 24, 2019 at 12:27:38PM -0700, Andrii Nakryiko wrote:
> Add tests for various array handling/relocation scenarios.
>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
...
> +
> +#define CORE_READ(dst, src) \
> + bpf_probe_read(dst, sizeof(*src), __builtin_preserve_access_index(src))
This is the key accessor that all progs will use.
Please split just this single macro into individual commit and add
detailed comment about its purpose and
what __builtin_preserve_access_index() does underneath.
> +SEC("raw_tracepoint/sys_enter")
> +int test_core_nesting(void *ctx)
> +{
> + struct core_reloc_arrays *in = (void *)&data.in;
> + struct core_reloc_arrays_output *out = (void *)&data.out;
> +
> + /* in->a[2] */
> + if (CORE_READ(&out->a2, &in->a[2]))
> + return 1;
> + /* in->b[1][2][3] */
> + if (CORE_READ(&out->b123, &in->b[1][2][3]))
> + return 1;
Powered by blists - more mailing lists