mbox series

[bpf,v2,0/4] libbpf: Fixes for ring buffer

Message ID 20221116072351.1168938-1-houtao@huaweicloud.com (mailing list archive)
Headers show
Series libbpf: Fixes for ring buffer | expand

Message

Hou Tao Nov. 16, 2022, 7:23 a.m. UTC
From: Hou Tao <houtao1@huawei.com>

Hi,

The patch set tries to fix the problems found when testing ringbuf by
using 4KB and 2GB size. Patch 1 fixes the probe of ring buffer map on
host with 64KB page (e.g., an ARM64 host). Patch 2 & 3 fix the overflow
of length when mmaping 2GB kernel ringbuf or user ringbuf on libbpf.
Patch 4 just reject the reservation with invalid size.

Please see individual patch for details. And comments are always
welcome.

Change Log:
v2:
 * patch 1: use page size instead of adjust_ringbuf_sz(4096) as main_entries (suggested by Stanislav)
 * patch 2 & 3: use "mmap_sz" instead of "ro_size/wr_size" as name of mmap length (From Andrii)
v1: https://lore.kernel.org/bpf/20221111092642.2333724-1-houtao@huaweicloud.com
 
Hou Tao (4):
  libbpf: Use page size as max_entries when probing ring buffer map
  libbpf: Handle size overflow for ringbuf mmap
  libbpf: Handle size overflow for user ringbuf mmap
  libbpf: Check the validity of size in user_ring_buffer__reserve()

 tools/lib/bpf/libbpf_probes.c |  2 +-
 tools/lib/bpf/ringbuf.c       | 26 ++++++++++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 18, 2022, midnight UTC | #1
Hello:

This series was applied to bpf/bpf.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Wed, 16 Nov 2022 15:23:47 +0800 you wrote:
> From: Hou Tao <houtao1@huawei.com>
> 
> Hi,
> 
> The patch set tries to fix the problems found when testing ringbuf by
> using 4KB and 2GB size. Patch 1 fixes the probe of ring buffer map on
> host with 64KB page (e.g., an ARM64 host). Patch 2 & 3 fix the overflow
> of length when mmaping 2GB kernel ringbuf or user ringbuf on libbpf.
> Patch 4 just reject the reservation with invalid size.
> 
> [...]

Here is the summary with links:
  - [bpf,v2,1/4] libbpf: Use page size as max_entries when probing ring buffer map
    https://git.kernel.org/bpf/bpf/c/689eb2f1ba46
  - [bpf,v2,2/4] libbpf: Handle size overflow for ringbuf mmap
    https://git.kernel.org/bpf/bpf/c/927cbb478adf
  - [bpf,v2,3/4] libbpf: Handle size overflow for user ringbuf mmap
    https://git.kernel.org/bpf/bpf/c/64176bff2446
  - [bpf,v2,4/4] libbpf: Check the validity of size in user_ring_buffer__reserve()
    https://git.kernel.org/bpf/bpf/c/05c1558bfcb6

You are awesome, thank you!