Skip to content

Install libdd_profiling-embedded.so to fix /tmp extraction and CAP_PERFMON loss#536

Open
xroche wants to merge 1 commit intoDataDog:mainfrom
algolia:fix/install-embedded-lib
Open

Install libdd_profiling-embedded.so to fix /tmp extraction and CAP_PERFMON loss#536
xroche wants to merge 1 commit intoDataDog:mainfrom
algolia:fix/install-embedded-lib

Conversation

@xroche
Copy link
Copy Markdown
Contributor

@xroche xroche commented Apr 2, 2026

Summary

When USE_LOADER=ON, the loader tries dlopen("libdd_profiling-embedded.so") before falling back to extracting the embedded copy. This dlopen always fails because dd_profiling-embedded is built but not included in the install targets.

As a result, the loader extracts both libdd_profiling-embedded.so and ddprof to /tmp. The extracted ddprof copy lacks file capabilities (CAP_PERFMON), so perf_event_open fails with EPERM.

Fix

Add dd_profiling-embedded to the CMake install targets when USE_LOADER=ON. The loader finds libdd_profiling-embedded.so via standard dlopen, skips extraction, and execvp("ddprof") uses the installed binary with its file capabilities.

Refs

@xroche
Copy link
Copy Markdown
Contributor Author

xroche commented Apr 2, 2026

cc @r1viollet — this fixes the /tmp extraction issue from #529. The embedded library was never installed, so the loader's bare-name dlopen always fell back to extracting to /tmp.

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: DataDog#535

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@r1viollet
Copy link
Copy Markdown
Collaborator

Thanks for the fix, I'll handover the integration to @nsavoire as I'm off for a few days.

@nsavoire
Copy link
Copy Markdown
Collaborator

nsavoire commented Apr 2, 2026

Thanks for the fix, I'll handover the integration to @nsavoire as I'm off for a few days.

I cherry-picked the commit into #534

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants