summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2026-09-26 17:45:14 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2026-09-30 14:04:05 +0200
commit6a75c73eebd4d497ded7d08b47894f9ddbebb5a9 (patch)
tree2bb3c750f15bcf364a61b7c46472e86f03e7b2ea /net
parent7d2fa34fd3386556dbfa3867368b097cdd9b279e (diff)
downloadlinux-next-6a75c73eebd4d497ded7d08b47894f9ddbebb5a9.tar.gz
linux-next-6a75c73eebd4d497ded7d08b47894f9ddbebb5a9.zip
bpftool: Exit from the stream wait signal handler with _exit()
bpftool prog tracelog -w ends from its SIGINT, SIGHUP and SIGTERM handler, which calls exit(). exit() is not async-signal-safe: it runs atexit handlers and flushes stdio streams, and the signal may land while the read loop is inside fwrite() or fflush() on the stream being flushed. Whether that deadlocks or flushes a half-updated buffer depends on the C library. Call _exit() instead. The loop flushes every chunk as soon as it is printed, so the stdio buffer is empty except while a chunk is being written, and skipping the exit-time flush loses nothing. While here, note in the manual page that opening a stream as a file descriptor arrives in Linux 7.4, and restrict the -w/--wait description to the stdout/stderr form of the tracelog command, since the trace pipe form does not take the option. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Quentin Monnet <qmo@kernel.org> Link: https://lore.kernel.org/bpf/d64c6402-175f-4ea6-be6d-1a544a95c97c@qmon.net Link: https://lore.kernel.org/bpf/20260926154515.191689-1-memxor@gmail.com
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions