linux/tools/lib/api
Ian Rogers 3cbb16ccd7 perf record: Fix unhandled POLLHUP on non_perf_event descriptors
When processing POLLHUP on a non_perf_event control descriptor,
evlist__finalize_ctlfd() is invoked to finalize the setup, correctly
setting the core evlist's poll array file descriptor to -1. However,
this finalized teardown state is never propagated back to the
individual thread's local replica of the pollfd array.

Consequently, on the next iteration of the main recording loop,
record__update_evlist_pollfd_from_thread() performs a strict
equivalence check between the core evlist's array and the thread's
localized poll array, detecting that the fd values no longer match.
This causes an immediate -EINVAL abort and a premature teardown.

Fix the underlying logic within
record__update_evlist_pollfd_from_thread() to sustainably propagate
the finalized teardown statuses (-1) originating from the core evlist
back to the thread's localized poll structure. This correctly
maintains synchronization and entirely prevents the unhandled
index mismatch crashes.

Additionally, add a unit test that explicitly validates that
fdarray__filter() preserves its invariants regarding
fdarray_flag__nonfilterable items to guard against regressions.

Fixes: fb4751e79c ("perf record: Fix teardown hang on system-wide multi-threaded sessions")
Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Gemini:gemini-3.1-pro
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2026-09-17 12:27:34 -03:00
..
fd perf record: Fix unhandled POLLHUP on non_perf_event descriptors 2026-09-17 12:27:34 -03:00
fs tools lib api: Fix mount_overload() snprintf truncation and toupper range 2026-06-10 18:56:02 -03:00
Build
cpu.c
cpu.h
debug-internal.h
debug.c
debug.h
io_dir.h libapi: Add missing header with NAME_MAX define to io_dir.h 2025-03-13 00:29:36 -07:00
io.h tools api io: Ensure line_len_out is always initialized 2024-11-08 22:46:44 -08:00
Makefile tools/build: selftests: Remove some duplicate toolchain definitions 2026-07-25 22:25:00 -07:00