Re: [PATCH bpf-next 06/10] selftests/bpf: add CO-RE relocs array tests

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

 



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@xxxxxx>
...
> +
> +#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;



[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