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: <c3f1b8ce39335ea0061a8b75a943f12638da6a9c.camel@gmail.com>
Date: Mon, 27 Oct 2025 11:53:07 -0700
From: Eduard Zingerman <eddyz87@...il.com>
To: Donglin Peng <dolinux.peng@...il.com>, ast@...nel.org
Cc: linux-kernel@...r.kernel.org, bpf@...r.kernel.org, Andrii Nakryiko	
 <andrii.nakryiko@...il.com>, Alan Maguire <alan.maguire@...cle.com>, Song
 Liu	 <song@...nel.org>, pengdonglin <pengdonglin@...omi.com>
Subject: Re: [RFC PATCH v3 2/3] selftests/bpf: add tests for BTF type
 permutation

On Mon, 2025-10-27 at 21:54 +0800, Donglin Peng wrote:
> Verify that BTF type permutation functionality works correctly.
> 
> Cc: Eduard Zingerman <eddyz87@...il.com>
> Cc: Alexei Starovoitov <ast@...nel.org>
> Cc: Andrii Nakryiko <andrii.nakryiko@...il.com>
> Cc: Alan Maguire <alan.maguire@...cle.com>
> Cc: Song Liu <song@...nel.org>
> Signed-off-by: pengdonglin <pengdonglin@...omi.com>
> Signed-off-by: Donglin Peng <dolinux.peng@...il.com>
> ---

Do we need a test case for split btf?
We probably do, as there is index arithmetic etc.

[...]

> @@ -8022,6 +8026,72 @@ static struct btf_dedup_test dedup_tests[] = {
>  		BTF_STR_SEC("\0foo\0x\0y\0foo_ptr"),
>  	},
>  },
> +{
> +	.descr = "permute: func/func_param/struct/struct_member tags",
> +	.input = {
> +		.raw_types = {
> +			/* int */
> +			BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),	/* [1] */
> +			/* void f(int a1, int a2) */
> +			BTF_FUNC_PROTO_ENC(0, 2),			/* [2] */
> +				BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(1), 1),
> +				BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(2), 1),
> +			BTF_FUNC_ENC(NAME_NTH(3), 2),			/* [3] */
> +			/* struct t {int m1; int m2;} */
> +			BTF_STRUCT_ENC(NAME_NTH(4), 2, 8),		/* [4] */
> +				BTF_MEMBER_ENC(NAME_NTH(5), 1, 0),
> +				BTF_MEMBER_ENC(NAME_NTH(6), 1, 32),
> +			/* tag -> f: tag1, tag2, tag3 */
> +			BTF_DECL_TAG_ENC(NAME_NTH(7), 3, -1),		/* [5] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(8), 3, -1),		/* [6] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(9), 3, -1),		/* [7] */
> +			/* tag -> f/a2: tag1, tag2, tag3 */
> +			BTF_DECL_TAG_ENC(NAME_NTH(7), 3, 1),		/* [8] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(8), 3, 1),		/* [9] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(9), 3, 1),		/* [10] */
> +			/* tag -> t: tag1, tag2, tag3 */
> +			BTF_DECL_TAG_ENC(NAME_NTH(7), 4, -1),		/* [11] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(8), 4, -1),		/* [12] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(9), 4, -1),		/* [13] */
> +			/* tag -> t/m2: tag1, tag3 */
> +			BTF_DECL_TAG_ENC(NAME_NTH(7), 4, 1),		/* [14] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(8), 4, 1),		/* [15] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(9), 4, 1),		/* [16] */
> +			BTF_END_RAW,
> +		},
> +		BTF_STR_SEC("\0a1\0a2\0f\0t\0m1\0m2\0tag1\0tag2\0tag3"),
> +	},

Nit: I think that this test is a bit too large.
     Having fewer decl_tags would still test what we want to test.

> +	.expect = {
> +		.raw_types = {
> +			BTF_FUNC_ENC(NAME_NTH(3), 16),			/* [1] */
> +			BTF_STRUCT_ENC(NAME_NTH(4), 2, 8),		/* [2] */
> +				BTF_MEMBER_ENC(NAME_NTH(5), 15, 0),
> +				BTF_MEMBER_ENC(NAME_NTH(6), 15, 32),
> +			BTF_DECL_TAG_ENC(NAME_NTH(7), 1, -1),		/* [3] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(7), 1,  1),		/* [4] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(7), 2, -1),		/* [5] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(7), 2,  1),		/* [6] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(8), 1, -1),		/* [7] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(8), 1,  1),		/* [8] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(8), 2, -1),		/* [9] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(8), 2,  1),		/* [10] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(9), 1, -1),		/* [11] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(9), 1,  1),		/* [12] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(9), 2, -1),		/* [13] */
> +			BTF_DECL_TAG_ENC(NAME_NTH(9), 2,  1),		/* [14] */
> +			BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),	/* [15] */
> +			BTF_FUNC_PROTO_ENC(0, 2),			/* [16] */
> +				BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(1), 15),
> +				BTF_FUNC_PROTO_ARG_ENC(NAME_NTH(2), 15),
> +			BTF_END_RAW,
> +		},
> +		BTF_STR_SEC("\0a1\0a2\0f\0t\0m1\0m2\0tag1\0tag2\0tag3"),
> +	},
> +	.permute = true,
> +	.permute_opts = {
> +		.ids = permute_ids_sort_by_kind_name,
> +	},
> +},
>  };

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ