public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf v4 0/5] Fixes for bits iterator
@ 2024-10-30 10:05 Hou Tao
  2024-10-30 10:05 ` [PATCH bpf v4 1/5] bpf: Free dynamically allocated bits in bpf_iter_bits_destroy() Hou Tao
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Hou Tao @ 2024-10-30 10:05 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, Yafang Shao, houtao1, xukuohai

From: Hou Tao <houtao1@huawei.com>

Hi,

The patch set fixes several issues in bits iterator. Patch #1 fixes the
kmemleak problem of bits iterator. Patch #2~#3 fix the overflow problem
of nr_bits. Patch #4 fixes the potential stack corruption when bits
iterator is used on 32-bit host. Patch #5 adds more test cases for bits
iterator.

Please see the individual patches for more details. And comments are
always welcome.

---
v4:
 * patch #1: add ack from Yafang
 * patch #3: revert code-churn like changes:
   (1) compute nr_bytes and nr_bits before the check of nr_words.
   (2) use nr_bits == 64 to check for single u64, preventing build
       warning on 32-bit hosts.
 * patch #4: use "BITS_PER_LONG == 32" instead of "!defined(CONFIG_64BIT)"

v3: https://lore.kernel.org/bpf/20241025013233.804027-1-houtao@huaweicloud.com/T/#t
  * split the bits-iterator related patches from "Misc fixes for bpf"
    patch set
  * patch #1: use "!nr_bits || bits >= nr_bits" to stop the iteration
  * patch #2: add a new helper for the overflow problem
  * patch #3: decrease the limitation from 512 to 511 and check whether
    nr_bytes is too large for bpf memory allocator explicitly
  * patch #5: add two more test cases for bit iterator

v2: http://lore.kernel.org/bpf/d49fa2f4-f743-c763-7579-c3cab4dd88cb@huaweicloud.com

Hou Tao (5):
  bpf: Free dynamically allocated bits in bpf_iter_bits_destroy()
  bpf: Add bpf_mem_alloc_check_size() helper
  bpf: Check the validity of nr_words in bpf_iter_bits_new()
  bpf: Use __u64 to save the bits in bits iterator
  selftests/bpf: Add three test cases for bits_iter

 include/linux/bpf_mem_alloc.h                 |  3 +
 kernel/bpf/helpers.c                          | 54 +++++++++++++---
 kernel/bpf/memalloc.c                         | 14 ++++-
 .../selftests/bpf/progs/verifier_bits_iter.c  | 61 ++++++++++++++++++-
 4 files changed, 118 insertions(+), 14 deletions(-)

-- 
2.29.2


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

end of thread, other threads:[~2024-10-30 19:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-30 10:05 [PATCH bpf v4 0/5] Fixes for bits iterator Hou Tao
2024-10-30 10:05 ` [PATCH bpf v4 1/5] bpf: Free dynamically allocated bits in bpf_iter_bits_destroy() Hou Tao
2024-10-30 10:05 ` [PATCH bpf v4 2/5] bpf: Add bpf_mem_alloc_check_size() helper Hou Tao
2024-10-30 10:05 ` [PATCH bpf v4 3/5] bpf: Check the validity of nr_words in bpf_iter_bits_new() Hou Tao
2024-10-30 10:05 ` [PATCH bpf v4 4/5] bpf: Use __u64 to save the bits in bits iterator Hou Tao
2024-10-30 10:05 ` [PATCH bpf v4 5/5] selftests/bpf: Add three test cases for bits_iter Hou Tao
2024-10-30 19:20 ` [PATCH bpf v4 0/5] Fixes for bits iterator 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