You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test heap injection into executables with file capabilities #562
Keep this as a future Linux integration test case: heap-profiler injection can be suppressed when a non-root user launches an executable with file capabilities.
Observed with an Envoy binary carrying cap_net_bind_service=ep, launched as UID 100. Executing it grants a capability and triggers secure execution (AT_SECURE); glibc ignores ddprof's path-based LD_PRELOAD, preventing allocation-library injection.
The preload was honored when running as root with the capability already permitted.
Future test case
Use a dynamically linked malloc/free fixture in a suitably privileged Linux test setup:
Run it through ddprof --preset cpu_live_heap as a non-root user without file capabilities. Verify injection and allocation samples.
Apply setcap cap_net_bind_service=ep to the fixture and repeat, with that capability available in the bounding set so execution can gain it.
Remove the file capability and repeat as a control.
Cover ddprof's behavior/diagnostic for the secure-execution case, and assert library injection and allocation samples rather than just successful startup or CPU samples. This is a test-coverage reminder, not a request to bypass the loader's security protections.
The new simple_malloc-file-capabilities CTest runs the target as nobody through ddprof --switch_user, keeping the profiler privileged. It applies/removes cap_net_bind_service=ep on a private copy of simple_malloc, checks its reported security context, and counts allocation samples in do_lot_of_allocations.
# From a suitable privileged Linux build directory, as root:
ctest -R '^simple_malloc-file-capabilities$' -V
The test passes by asserting the current limitation, not by fixing injection. It passed 20 consecutive runs; the existing simple_malloc and event-reordering tests also passed. Non-root and nosuid environments were verified to return skip code 77 rather than report a successful reproduction. No production profiler code was changed.
Activity
r1viollet commentedon Oct 20, 2026
Test-only reproducer pushed on
r1viollet/simple-malloc-file-capabilities: commit 23fd454c.The new
simple_malloc-file-capabilitiesCTest runs the target asnobodythroughddprof --switch_user, keeping the profiler privileged. It applies/removescap_net_bind_service=epon a private copy ofsimple_malloc, checks its reported security context, and counts allocation samples indo_lot_of_allocations.Observed on x86_64 Linux, Ubuntu 24.04/glibc 2.39, GCC 14 Debug build:
The test passes by asserting the current limitation, not by fixing injection. It passed 20 consecutive runs; the existing
simple_mallocand event-reordering tests also passed. Non-root andnosuidenvironments were verified to return skip code 77 rather than report a successful reproduction. No production profiler code was changed.