]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf tools: Add O_CLOEXEC to open() calls in DSO and ELF code
authorArnaldo Carvalho de Melo <acme@redhat.com>
Sun, 7 Jun 2026 00:51:42 +0000 (21:51 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 10 Jun 2026 18:23:53 +0000 (15:23 -0300)
commitb145137fec13dc8fc7fcb14193ce395a1164e3a1
tree7fb6d7c95d54f3bd5f20f019c5f7d7587ab2ebb9
parentd9b99dc8148e0c1f5da3942131b47e0d21187a32
perf tools: Add O_CLOEXEC to open() calls in DSO and ELF code

open() calls in dso.c and symbol-elf.c omit O_CLOEXEC, which leaks
file descriptors to child processes spawned during symbol resolution
(e.g., addr2line, objdump).  This can exhaust the fd limit during
long profiling sessions or when processing many DSOs.

Add O_CLOEXEC to all open() calls in both files (12 call sites).

Fixes: cdd059d731eeb466 ("perf tools: Move dso_* related functions into dso object")
Fixes: e5a1845fc0aeca85 ("perf symbols: Split out util/symbol-elf.c")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/dso.c
tools/perf/util/symbol-elf.c