From ca4b743eb89d31fe87b2df871e6abe11709fb7f3 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Thu, 2 Apr 2026 18:02:56 +0200 Subject: [PATCH] fix: install libdd_profiling-embedded.so to avoid /tmp extraction The loader tries dlopen("libdd_profiling-embedded.so") before falling back to extracting the embedded copy to /tmp. But the embedded library was never included in the install targets, so the dlopen always fails. The /tmp copy of ddprof lacks file capabilities (CAP_PERFMON), which causes perf_event_open to fail with EPERM. Add dd_profiling-embedded to the install targets when USE_LOADER is ON so the loader finds it via standard dlopen and never falls back to /tmp. Upstream: https://github.com/DataDog/ddprof/issues/535 Co-Authored-By: Claude Opus 4.6 (1M context) --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 023445e4..f56d45dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -441,8 +441,17 @@ if(BUILD_UNIVERSAL_DDPROF) endif() endif() +set(_install_targets ddprof dd_profiling-static dd_profiling-shared) +if(USE_LOADER) + # Install the embedded profiling library so the loader can dlopen it from a + # standard path instead of extracting the copy baked into the loader to /tmp. + # The /tmp fallback loses file capabilities (CAP_PERFMON) on the ddprof + # binary, which breaks perf_event_open. + list(APPEND _install_targets dd_profiling-embedded) +endif() + install( - TARGETS ddprof dd_profiling-static dd_profiling-shared + TARGETS ${_install_targets} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib