Description
When USE_LOADER=ON (the default), the loader (libdd_profiling.so) tries to dlopen("libdd_profiling-embedded.so") at construction time (loader.c:312). This always fails because libdd_profiling-embedded.so is not included in the install targets or the release tarball — it only exists as binary data embedded inside the loader.
Since the dlopen fails, the loader extracts both libdd_profiling-embedded.so and ddprof to /tmp. The /tmp copy of ddprof lacks file capabilities (CAP_PERFMON, CAP_SYS_PTRACE, CAP_IPC_LOCK), so perf_event_open fails with EPERM.
This makes the "skip /tmp extraction when libraries are installed" fix from #529 / commit 90b41db ineffective in practice.
Reproduction
Install ddprof 0.25.0 from the release tarball on any system:
$ ls /usr/lib/libdd_profiling*
/usr/lib/libdd_profiling.so # the loader — installed
# libdd_profiling-embedded.so — NOT installed
$ ls /tmp/ddprof-* /tmp/libdd_profiling-embedded*
/tmp/ddprof-<hash> # extracted, no file caps
/tmp/libdd_profiling-embedded.so-<hash> # extracted
Proposed fix
Add dd_profiling-embedded to the CMake install targets when USE_LOADER=ON:
set(_install_targets ddprof dd_profiling-static dd_profiling-shared)
if(USE_LOADER)
list(APPEND _install_targets dd_profiling-embedded)
endif()
install(
TARGETS ${_install_targets}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include)
With this change, the loader finds libdd_profiling-embedded.so via standard dlopen search, skips /tmp extraction entirely, and execvp("ddprof") finds /usr/bin/ddprof with its file capabilities intact.
Description
When
USE_LOADER=ON(the default), the loader (libdd_profiling.so) tries todlopen("libdd_profiling-embedded.so")at construction time (loader.c:312). This always fails becauselibdd_profiling-embedded.sois not included in the install targets or the release tarball — it only exists as binary data embedded inside the loader.Since the dlopen fails, the loader extracts both
libdd_profiling-embedded.soandddprofto/tmp. The/tmpcopy ofddproflacks file capabilities (CAP_PERFMON,CAP_SYS_PTRACE,CAP_IPC_LOCK), soperf_event_openfails withEPERM.This makes the "skip /tmp extraction when libraries are installed" fix from #529 / commit 90b41db ineffective in practice.
Reproduction
Install ddprof 0.25.0 from the release tarball on any system:
Proposed fix
Add
dd_profiling-embeddedto the CMake install targets whenUSE_LOADER=ON:With this change, the loader finds
libdd_profiling-embedded.sovia standard dlopen search, skips/tmpextraction entirely, andexecvp("ddprof")finds/usr/bin/ddprofwith its file capabilities intact.