Skip to content

Commit a485ef4

Browse files
cataphractclaude
andcommitted
Fix ddtrace.so execute bit for ExecSolib in all build paths
ExecSolib requires execute permission on ddtrace.so (execve fails with EACCES without it). Several build paths were missing chmod +x: - build-tracing.sh: add chmod +x to standalone_* .so files used by SSI packages and generate-final-artifact.sh - link-tracing-extension.sh: add chmod +x to extensions_* .so files used by deb/rpm/tar.gz packages - libdatadog/spawn_worker: best-effort chmod before execve to handle cases where PHP's make install uses mode 0644 (no execute bit) - datadog-setup.php: unconditionally chmod +x installed .so files rather than depending on the source having execute bit Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 57936b0 commit a485ef4

5 files changed

Lines changed: 9 additions & 4 deletions

File tree

.gitlab/build-tracing.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ fi
3131
switch-php "${PHP_VERSION}"
3232
make clean && make -j "${MAKE_JOBS}" static
3333
objcopy --compress-debug-sections tmp/build_extension/modules/ddtrace.so "standalone_$(uname -m)/ddtrace-${PHP_API}${suffix}.so"
34+
chmod +x "standalone_$(uname -m)/ddtrace-${PHP_API}${suffix}.so"
3435
cp -v tmp/build_extension/modules/ddtrace.a "extensions_$(uname -m)/ddtrace-${PHP_API}${suffix}.a"
3536
if [ "${PHP_VERSION}" = "7.0" ]; then
3637
cp -v tmp/build_extension/ddtrace.ldflags "ddtrace_$(uname -m)${suffix}.ldflags"
@@ -41,6 +42,7 @@ if [ "${suffix}" != "-alpine" ]; then
4142
switch-php "${PHP_VERSION}-debug"
4243
make clean && make -j "${MAKE_JOBS}" static
4344
objcopy --compress-debug-sections tmp/build_extension/modules/ddtrace.so "standalone_$(uname -m)/ddtrace-${PHP_API}${suffix}-debug.so"
45+
chmod +x "standalone_$(uname -m)/ddtrace-${PHP_API}${suffix}-debug.so"
4446
cp -v tmp/build_extension/modules/ddtrace.a "extensions_$(uname -m)/ddtrace-${PHP_API}${suffix}-debug.a"
4547
fi
4648

@@ -49,4 +51,5 @@ switch-php "${PHP_VERSION}-zts"
4951
rm -r tmp/build_extension
5052
make clean && make -j "${MAKE_JOBS}" static
5153
objcopy --compress-debug-sections tmp/build_extension/modules/ddtrace.so "standalone_$(uname -m)/ddtrace-${PHP_API}${suffix}-zts.so"
54+
chmod +x "standalone_$(uname -m)/ddtrace-${PHP_API}${suffix}-zts.so"
5255
cp -v tmp/build_extension/modules/ddtrace.a "extensions_$(uname -m)/ddtrace-${PHP_API}${suffix}-zts.a"

.gitlab/link-tracing-extension.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ for archive in extensions_$(uname -m)/*.a; do
99
(
1010
cc -shared -Wl,-whole-archive $archive -Wl,-no-whole-archive $(cat "ddtrace_$(uname -m)${suffix}.ldflags") "libddtrace_php_$(uname -m)${suffix}.a" -Wl,-soname -Wl,ddtrace.so -o ${archive%.a}.so
1111
objcopy --compress-debug-sections ${archive%.a}.so
12+
chmod +x ${archive%.a}.so
1213
) &
1314
pids+=($!)
1415
done

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datadog-setup.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -956,9 +956,9 @@ function safe_copy_extension($source, $destination)
956956

957957
$tmpName = $destination . '.tmp';
958958
copy($source, $tmpName);
959-
// Preserve execute permission from source: required for ExecSolib (the kernel
960-
// execve's ddtrace.so directly to spawn the sidecar).
961-
if (!IS_WINDOWS && is_executable($source)) {
959+
// Add execute permission: required for ExecSolib (the kernel execve's ddtrace.so
960+
// directly to spawn the sidecar). Safe to apply unconditionally to .so files.
961+
if (!IS_WINDOWS) {
962962
chmod($tmpName, fileperms($tmpName) | 0111);
963963
}
964964
rename($tmpName, $destination);

libdatadog

0 commit comments

Comments
 (0)