Commit 59abc04
fix(ExecSolib): compile trampoline as PIE; abort on ET_EXEC
The trampoline binary embedded in ddtrace.so was produced as ET_EXEC
(non-PIE) by toolchains that don't default to -fPIE (e.g. devtoolset-7
on CentOS 7). elf_load_trampoline accepted only ET_DYN and used
mmap(NULL) to pick a random load base — an ET_EXEC binary loaded that
way crashes because its absolute virtual addresses no longer match.
Two-pronged fix:
1. libdatadog/spawn_worker/build.rs: add -fPIE/-pie on Linux so the
trampoline is always ET_DYN, matching the original design intent.
2. solib_bootstrap.c: add a __builtin_trap() guard after the ET_DYN
check so a mis-built ET_EXEC trampoline aborts loudly instead of
silently misbehaving.
Fixes "failed to map trampoline" (exit 121) on bookworm-slim for
PHP 8.3-8.5.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent da0f6aa commit 59abc04
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
712 | 717 | | |
713 | 718 | | |
714 | 719 | | |
| |||
Submodule libdatadog updated 1 file
0 commit comments