linux/tools/perf
Ian Rogers b72b8132d8 perf libbfd: Ensure libbfd is initialized prior to use
Multiple threads may be creating and destroying BFD objects in
situations like `perf top`.

Without appropriate initialization crashes may occur during libbfd's
cache management.

BFD's locks require recursive mutexes, add support for these.

Committer testing:

This happens only when building with 'make BUILD_NONDISTRO=1' and having
the binutils-devel package (or equivalent) installed, i.e. linking with
binutils devel files, an opt-in perf build.

Before:

  root@x1:~# perf top
  perf: Segmentation fault
  -------- backtrace --------
  <SNIP multiple failed attempts at printing a backtrace>
  root@x1:~#

After this patch it works as before.

Closes: https://lore.kernel.org/lkml/aQt66zhfxSA80xwt@gentoo.org/
Fixes: 95931d9a59 ("perf libbfd: Move libbfd functionality to its own file")
Reported-by: Guilherme Amadio <amadio@gentoo.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2025-11-13 17:55:19 -03:00
..
Documentation perf docs: Document building with Clang 2025-10-06 16:49:25 -03:00
arch tools headers x86: Sync table due to introducion of uprobe syscall 2025-11-01 13:04:20 -03:00
bench - Simplify inline asm flag output operands now that the minimum compiler 2025-10-11 10:51:14 -07:00
check-header_ignore_hunks/lib
dlfilters
include/perf perf dso: Move build_id to dso_id 2025-07-25 10:37:56 -07:00
jvmti perf: Fix libjvmti.c sign compare error 2025-06-09 22:12:08 -07:00
pmu-events perf vendor events intel: Update sierraforest events to v1.12 2025-09-30 13:36:18 -03:00
python perf ilist: Add support for metrics 2025-09-03 12:34:54 -03:00
scripts perf build: Disable thread safety analysis for perl header 2025-10-06 16:49:25 -03:00
tests perf test: Fix lock contention test 2025-11-13 17:29:00 -03:00
trace tools headers: Sync uapi/linux/fcntl.h with the kernel sources 2025-11-01 13:01:13 -03:00
ui tools build: Remove feature-libslang-include-subdir 2025-10-03 16:49:51 -03:00
util perf libbfd: Ensure libbfd is initialized prior to use 2025-11-13 17:55:19 -03:00
.gitignore perf tools: Remove libtraceevent in .gitignore 2025-07-26 15:38:10 -07:00
Build perf build: Specify shellcheck should use bash 2025-06-30 09:43:06 -07:00
CREDITS
MANIFEST perf tools: Fix arm64 source package build 2025-05-13 17:26:35 -03:00
Makefile
Makefile.config perf build: Don't fail fast path feature detection when binutils-devel is not available 2025-11-13 17:16:34 -03:00
Makefile.perf perf tools: Fix arm64 libjvmti build by generating unistd_64.h 2025-10-06 17:16:52 -03:00
builtin-annotate.c perf annotate: Add --code-with-type support for TUI 2025-08-28 12:33:08 -03:00
builtin-bench.c perf bench mem: Add mmap() workloads 2025-09-19 12:43:59 -03:00
builtin-buildid-cache.c perf symbol: Add blocking argument to filename__read_build_id 2025-08-25 15:07:18 -07:00
builtin-buildid-list.c perf machine: Explicitly pass in host perf_env 2025-07-25 10:37:57 -07:00
builtin-c2c.c perf sort: Use perf_env to set arch sort keys and header 2025-07-25 10:37:58 -07:00
builtin-check.c perf check: Add libLLVM feature 2025-10-06 15:24:13 -03:00
builtin-config.c
builtin-daemon.c
builtin-data.c
builtin-diff.c perf sort: Use perf_env to set arch sort keys and header 2025-07-25 10:37:58 -07:00
builtin-evlist.c
builtin-ftrace.c perf: ftrace: add graph tracer options args/retval/retval-hex/retaddr 2025-07-22 17:47:22 -07:00
builtin-help.c
builtin-inject.c perf symbol: Add blocking argument to filename__read_build_id 2025-08-25 15:07:18 -07:00
builtin-kallsyms.c perf machine: Explicitly pass in host perf_env 2025-07-25 10:37:57 -07:00
builtin-kmem.c perf session: Add accessor for session->header.env 2025-07-25 10:37:56 -07:00
builtin-kvm.c perf tools kvm: Use "cycles" to sample guest for "kvm top" on Intel 2025-10-02 15:31:55 -03:00
builtin-kwork.c perf tools kwork: Add missed memory allocation check and free 2025-10-02 15:30:30 -03:00
builtin-list.c perf list: Skip ABI PMUs when printing pmu values 2025-07-26 16:31:43 -07:00
builtin-lock.c perf lock: Fix segfault due to missing kernel map 2025-11-13 17:17:41 -03:00
builtin-mem.c perf session: Add accessor for session->header.env 2025-07-25 10:37:56 -07:00
builtin-probe.c
builtin-record.c perf stat: Refactor retry/skip/fatal error handling 2025-10-03 16:49:51 -03:00
builtin-report.c perf sort: Use perf_env to set arch sort keys and header 2025-07-25 10:37:58 -07:00
builtin-sched.c perf sched: Avoid union type punning undefined behavior 2025-10-01 11:22:04 -03:00
builtin-script.c perf capstone: Move capstone functionality into its own file 2025-10-02 15:36:59 -03:00
builtin-stat.c perf stat: Refactor retry/skip/fatal error handling 2025-10-03 16:49:51 -03:00
builtin-timechart.c perf session: Add accessor for session->header.env 2025-07-25 10:37:56 -07:00
builtin-top.c perf sort: Use perf_env to set arch sort keys and header 2025-07-25 10:37:58 -07:00
builtin-trace.c perf trace: Fix IS_ERR() vs NULL check bug 2025-09-19 12:42:07 -03:00
builtin-version.c perf check: Share the feature status printing routine with 'perf version' 2025-04-10 10:44:04 -03:00
builtin.h perf check: Allow showing a tip for opt-in features not built into perf 2025-04-10 10:44:42 -03:00
check-headers.sh tools include: Add headers to make tools builds more hermetic 2025-10-02 15:13:19 -03:00
command-list.txt
design.txt
perf-archive.sh tools/perf: Add --exclude-buildids option to perf archive command 2025-06-26 15:40:19 -07:00
perf-completion.sh
perf-iostat.sh
perf-read-vdso.c
perf-sys.h
perf.c perf env: Remove global perf_env 2025-07-25 10:37:58 -07:00
perf.h perf: Completely remove possibility to override MAX_NR_CPUS 2025-09-12 10:52:22 -03:00