BPF List
 help / color / mirror / Atom feed
* [PATCH bpf RESEND 0/2] Check the remaining info_cnt before repeating btf fields
@ 2024-10-08  7:11 Hou Tao
  2024-10-08  7:11 ` [PATCH bpf RESEND 1/2] bpf: " Hou Tao
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Hou Tao @ 2024-10-08  7:11 UTC (permalink / raw)
  To: bpf
  Cc: Martin KaFai Lau, Alexei Starovoitov, Andrii Nakryiko,
	Eduard Zingerman, Song Liu, Hao Luo, Yonghong Song,
	Daniel Borkmann, KP Singh, Stanislav Fomichev, Jiri Olsa,
	John Fastabend, Kui-Feng Lee, houtao1, xukuohai

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(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-09 23:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08  7:11 [PATCH bpf RESEND 0/2] Check the remaining info_cnt before repeating btf fields Hou Tao
2024-10-08  7:11 ` [PATCH bpf RESEND 1/2] bpf: " Hou Tao
2024-10-09  6:42   ` Eduard Zingerman
2024-10-09  7:12     ` Hou Tao
2024-10-09  7:26       ` Eduard Zingerman
2024-10-08  7:11 ` [PATCH bpf RESEND 2/2] selftests/bpf: Add more test case for field flattening Hou Tao
2024-10-09  7:29   ` Eduard Zingerman
2024-10-09 23:50 ` [PATCH bpf RESEND 0/2] Check the remaining info_cnt before repeating btf fields patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox