mbox series

[bpf,RESEND,0/2] Check the remaining info_cnt before repeating btf fields

Message ID 20241008071114.3718177-1-houtao@huaweicloud.com (mailing list archive)
Headers show
Series Check the remaining info_cnt before repeating btf fields | expand

Message

Hou Tao Oct. 8, 2024, 7:11 a.m. UTC
From: Hou Tao <houtao1@huawei.com>

Hi,

The patch set adds the missed check again info_cnt when flattening the
array of nested struct. The problem was spotted when developing dynptr
key support for hash map. Patch #1 adds the missed check and patch #2
adds three success test cases and one failure test case for the problem.

Comments are always welcome.

Change Log:
v2:
 * patch #1: check info_cnt in btf_repeat_fields()
 * patch #2: use a hard-coded number instead of BTF_FIELDS_MAX, because
             BTF_FIELDS_MAX is not always available in vmlinux.h (e.g.,
	     for llvm 17/18)

v1: https://lore.kernel.org/bpf/20240911110557.2759801-1-houtao@huaweicloud.com/T/#t

Hou Tao (2):
  bpf: Check the remaining info_cnt before repeating btf fields
  selftests/bpf: Add more test case for field flattening

 kernel/bpf/btf.c                              | 14 +++-
 .../selftests/bpf/prog_tests/cpumask.c        |  1 +
 .../selftests/bpf/progs/cpumask_common.h      |  5 ++
 .../selftests/bpf/progs/cpumask_failure.c     | 35 +++++++++
 .../selftests/bpf/progs/cpumask_success.c     | 78 ++++++++++++++++++-
 5 files changed, 127 insertions(+), 6 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 9, 2024, 11:50 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Tue,  8 Oct 2024 15:11:12 +0800 you wrote:
> From: Hou Tao <houtao1@huawei.com>
> 
> Hi,
> 
> The patch set adds the missed check again info_cnt when flattening the
> array of nested struct. The problem was spotted when developing dynptr
> key support for hash map. Patch #1 adds the missed check and patch #2
> adds three success test cases and one failure test case for the problem.
> 
> [...]

Here is the summary with links:
  - [bpf,RESEND,1/2] bpf: Check the remaining info_cnt before repeating btf fields
    https://git.kernel.org/bpf/bpf/c/797d73ee232d
  - [bpf,RESEND,2/2] selftests/bpf: Add more test case for field flattening
    https://git.kernel.org/bpf/bpf/c/c456f0804058

You are awesome, thank you!