Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: System Tests

on:
# pull_request:
pull_request:
push:
branches: [main]
workflow_dispatch:
Expand Down Expand Up @@ -50,8 +50,9 @@ jobs:
library: cpp_httpd
binaries_artifact: system_tests_binaries
desired_execution_time: 300 # 5 minutes
scenarios_groups: tracer-release
excluded_scenarios: APM_TRACING_E2E_OTEL,APM_TRACING_E2E_SINGLE_SPAN # require AWS and datadog credentials
scenarios: DEFAULT
# the whole tracer-release group only on main, pull requests run DEFAULT
scenarios_groups: ${{ github.ref == 'refs/heads/main' && 'tracer-release' || '' }}
parametric_job_count: 8
skip_empty_scenarios: false
push_to_test_optimization: ${{ github.actor != 'dependabot[bot]' }}
1 change: 1 addition & 0 deletions mod_datadog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ add_library(
src/common_conf.cpp
src/tracing/conf.cpp
src/tracing/hooks.cpp
src/libm_compat.cpp
)

set_property(TARGET mod_datadog PROPERTY POSITION_INDEPENDENT_CODE ON)
Expand Down
35 changes: 35 additions & 0 deletions mod_datadog/src/libm_compat.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// The module is built against musl, where libm is part of libc, and its libc
// dependency is removed (patch_away_libc): the host process provides libc. On
// glibc hosts, Apache doesn't load libm, so libm functions used by dependencies
// must be defined here, like ceil/ceilf in
// deps/nginx-datadog/build_env/glibc_compat.c.

#if defined(__linux__) && !defined(__GLIBC__)

// used by dd-trace-cpp (OpenTelemetry tracestate sampling)
extern "C" double round(double x) {
double result;
#if defined(__x86_64__)
// truncate, then round half away from zero. x - result is exact: same sign
// and |result| <= |x|.
// NOLINTNEXTLINE(hicpp-no-assembler)
__asm__("roundsd $0x0B, %[x], %[result]"
: [result] "=x"(result)
: [x] "x"(x));
Comment on lines +16 to +18

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the rounding code within the x86-64 ISA baseline

On an x86_64 host without SSE4.1, every call to this replacement executes the SSE4.1-only roundsd instruction and kills the Apache worker with SIGILL. The project publishes generic x86_64 artifacts without declaring a newer CPU baseline, so an otherwise supported older server or VM can load the module and then crash when dd-trace-cpp rounds a sampling value. Use a baseline-safe implementation or dispatch only after checking the CPU feature.

Useful? React with 👍 / 👎.

const double fraction = x - result;
if (fraction >= 0.5) {
result += 1.0;
} else if (fraction <= -0.5) {
result -= 1.0;
}
#elif defined(__aarch64__)
// round to nearest, ties away from zero
// NOLINTNEXTLINE(hicpp-no-assembler)
__asm__("frinta %d0, %d1\n" : "=w"(result) : "w"(x));
#else
#error "round is not implemented for this architecture"
#endif
return result;
}

#endif
Loading