BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/3] bpftool: fix batch file handling issues
@ 2026-08-10  7:33 chenyuan_fl
  2026-08-10  7:33 ` [PATCH bpf-next v3 1/3] bpftool: fix double close in map dump chenyuan_fl
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: chenyuan_fl @ 2026-08-10  7:33 UTC (permalink / raw)
  To: bpf
  Cc: Quentin Monnet, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi,
	Yuan Chen

From: Yuan Chen <chenyuan@kylinos.cn>

This series fixes three issues in bpftool's batch file handling:

 1. map dump closes the map fd twice (introduced by the map-by-name
    dump refactor).
 2. do_batch() reports a spurious read failure because a stale errno
    from a previously executed command is used instead of checking the
    FILE stream state.
 3. (new in v3) a line longer than the batch buffer that contains a '#'
    within the buffered prefix bypasses the line length check: the
    comment stripping truncates the buffer before the length is
    checked, so the unread remainder of the line is parsed and executed
    as a separate command on the next loop iteration.

Changes in v3:
  - Add patch 3 fixing the pre-existing comment-stripping bypass of the
    batch line length check, as pointed out in review of v2.

Changes in v2:
  - Patch 2 now uses ferror() to detect read failures and tracks an
    overlong line explicitly instead of relying on errno; Fixes tag
    corrected to 71bb428fe2c1.

Yuan Chen (3):
  bpftool: fix double close in map dump
  bpftool: fix spurious batch file read error
  bpftool: Fix bypass of the batch line length check by comments

 tools/bpf/bpftool/main.c | 12 +++++++++---
 tools/bpf/bpftool/map.c  |  1 -
 2 files changed, 9 insertions(+), 4 deletions(-)

-- 
2.54.0


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

end of thread, other threads:[~2026-08-10  8:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10  7:33 [PATCH bpf-next v3 0/3] bpftool: fix batch file handling issues chenyuan_fl
2026-08-10  7:33 ` [PATCH bpf-next v3 1/3] bpftool: fix double close in map dump chenyuan_fl
2026-08-10  8:17   ` bot+bpf-ci
2026-08-10  7:33 ` [PATCH bpf-next v3 2/3] bpftool: fix spurious batch file read error chenyuan_fl
2026-08-10  8:32   ` bot+bpf-ci
2026-08-10  7:33 ` [PATCH bpf-next v3 3/3] bpftool: Fix bypass of the batch line length check by comments chenyuan_fl
2026-08-10  7:42   ` sashiko-bot
2026-08-10  8:32   ` bot+bpf-ci

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