ExecSolib strategy: make ddtrace.so directly executable#3711
ExecSolib strategy: make ddtrace.so directly executable#3711cataphract wants to merge 14 commits intomasterfrom
Conversation
|
✨ Fix all issues with BitsAI or with Cursor
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3711 +/- ##
==========================================
- Coverage 68.77% 68.73% -0.04%
==========================================
Files 166 166
Lines 19030 19030
Branches 1797 1797
==========================================
- Hits 13087 13080 -7
- Misses 5127 5135 +8
+ Partials 816 815 -1
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
67f74d6 to
83c3f82
Compare
Introduce the ExecSolib spawn strategy by embedding an ELF entry point (_dd_solib_start) into ddtrace.so itself.
But the import can't be declared hidden. In the end the symbol will be in the got but linker to emits a RELATIVE reloc (not GLOB_DAT) -- so should work with our self-relocation.
b3ce66c to
9720a80
Compare
The x86-64 inline asm restoring the kernel stack and jumping to ld.so:
"mov %[sp], %%rsp\n"
"xor %%edx, %%edx\n" // required: rdx = 0 for ld.so startup ABI
"jmpq *%[entry]\n"
GCC at -O0 allocated %[entry] (ldso_entry) to rdx, causing the xor to
zero the jump target before the jmpq executed → SIGSEGV at address 0x0
on every x86-64 ExecSolib launch.
The fix is to pin ldso_entry to rax via the "a" constraint. Using the
"rdx" clobber alone is not sufficient: GCC is permitted to allocate
input operands into clobbered registers because inputs are consumed
before the asm fires. A specific register constraint ("a" = rax) is
the correct and optimization-safe solution.
With the fix, GCC emits:
mov %rcx, %rsp ; stack_top in rcx (or any non-rax "r")
xor %edx, %edx ; zero rdx (harmless: entry is in rax)
jmpq *%rax ; jump to ldso_entry
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
0f21818 to
82345e8
Compare
Benchmarks [ tracer ]Benchmark execution time: 2026-03-22 03:32:20 Comparing candidate commit 9293858 in PR branch Found 0 performance improvements and 1 performance regressions! Performance is the same for 192 metrics, 1 unstable metrics. scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache
|
76bb66d to
4e0b02e
Compare
4e0b02e to
5d0650b
Compare
a485ef4 to
b6a70af
Compare
4cffacf to
9293858
Compare
Introduce the ExecSolib spawn strategy by embedding an ELF entry point (_dd_solib_start) into ddtrace.so itself.
ddtrace.so becomes pie executable and runs without the dynamic linker. After self-relocation:
tested on glibc and musl on linux aarch64
Description
Reviewer checklist