lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <494555f1-7c3b-76e3-b8ad-bfd56cf36a8d@fb.com>
Date:   Wed, 19 Aug 2020 09:44:32 -0700
From:   Yonghong Song <yhs@...com>
To:     Andrii Nakryiko <andriin@...com>, <bpf@...r.kernel.org>,
        <netdev@...r.kernel.org>, <ast@...com>, <daniel@...earbox.net>
CC:     <andrii.nakryiko@...il.com>, <kernel-team@...com>
Subject: Re: [PATCH v2 bpf-next 5/5] selftests/bpf: add tests for
 ENUMVAL_EXISTS/ENUMVAL_VALUE relocations



On 8/18/20 10:28 PM, Andrii Nakryiko wrote:
> Add tests validating existence and value relocations for enum value-based
> relocations. If __builtin_preserve_enum_value() built-in is not supported,
> skip tests.
> 
> Signed-off-by: Andrii Nakryiko <andriin@...com>
> ---
>   .../selftests/bpf/prog_tests/core_reloc.c     | 56 +++++++++++++
>   .../bpf/progs/btf__core_reloc_enumval.c       |  3 +
>   .../progs/btf__core_reloc_enumval___diff.c    |  3 +
>   .../btf__core_reloc_enumval___err_missing.c   |  3 +
>   .../btf__core_reloc_enumval___val3_missing.c  |  3 +
>   .../selftests/bpf/progs/core_reloc_types.h    | 84 +++++++++++++++++++
>   .../bpf/progs/test_core_reloc_enumval.c       | 73 ++++++++++++++++
>   7 files changed, 225 insertions(+)
>   create mode 100644 tools/testing/selftests/bpf/progs/btf__core_reloc_enumval.c
>   create mode 100644 tools/testing/selftests/bpf/progs/btf__core_reloc_enumval___diff.c
>   create mode 100644 tools/testing/selftests/bpf/progs/btf__core_reloc_enumval___err_missing.c
>   create mode 100644 tools/testing/selftests/bpf/progs/btf__core_reloc_enumval___val3_missing.c
>   create mode 100644 tools/testing/selftests/bpf/progs/test_core_reloc_enumval.c
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/core_reloc.c b/tools/testing/selftests/bpf/prog_tests/core_reloc.c
> index ad550510ef69..30e40ff4b0d8 100644
> --- a/tools/testing/selftests/bpf/prog_tests/core_reloc.c
> +++ b/tools/testing/selftests/bpf/prog_tests/core_reloc.c
> @@ -289,6 +289,23 @@ static int duration = 0;
>   	.fails = true,							\
>   }
>   
[...]
> +
> +SEC("raw_tracepoint/sys_enter")
> +int test_core_enumval(void *ctx)
> +{
> +#if __has_builtin(__builtin_preserve_enum_value)
> +	struct core_reloc_enumval_output *out = (void *)&data.out;
> +	enum named_enum named = 0;
> +	anon_enum anon = 0;
> +
> +	out->named_val1_exists = bpf_core_enum_value_exists(named, NAMED_ENUM_VAL1);
> +	out->named_val2_exists = bpf_core_enum_value_exists(enum named_enum, NAMED_ENUM_VAL2);
> +	out->named_val3_exists = bpf_core_enum_value_exists(enum named_enum, NAMED_ENUM_VAL3);
> +
> +	out->anon_val1_exists = bpf_core_enum_value_exists(anon, ANON_ENUM_VAL1);
> +	out->anon_val2_exists = bpf_core_enum_value_exists(anon_enum, ANON_ENUM_VAL2);
> +	out->anon_val3_exists = bpf_core_enum_value_exists(anon_enum, ANON_ENUM_VAL3);
> +
> +	out->named_val1 = bpf_core_enum_value(named, NAMED_ENUM_VAL1);
> +	out->named_val2 = bpf_core_enum_value(named, NAMED_ENUM_VAL2);
> +	/* NAMED_ENUM_VAL3 value is optional */
> +
> +	out->anon_val1 = bpf_core_enum_value(anon, ANON_ENUM_VAL1);
> +	out->anon_val2 = bpf_core_enum_value(anon, ANON_ENUM_VAL2);
> +	/* ANON_ENUM_VAL3 value is optional */
> +#else
> +	data.skip = true;
> +#endif
> +
> +	return 0;
> +}
> +

empty line at the end of file?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ