Skip to content

Commit a099908

Browse files
authored
Merge branch 'main' into zgu/fuzz_thread_local
2 parents 5726c0b + a4841f3 commit a099908

19 files changed

Lines changed: 1851 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
5050

5151
- name: Setup Java
52-
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
52+
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
5353
with:
5454
distribution: 'zulu'
5555
java-version: '21'
@@ -90,7 +90,7 @@ jobs:
9090
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
9191

9292
- name: Setup Java
93-
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
93+
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
9494
with:
9595
distribution: 'zulu'
9696
java-version: '21'

.github/workflows/codecheck.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676

7777
# Initializes the CodeQL tools for scanning.
7878
- name: Initialize CodeQL
79-
uses: github/codeql-action/init@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a # v4.36.3
79+
uses: github/codeql-action/init@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
8080
with:
8181
languages: ${{ matrix.language }}
8282
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -85,4 +85,4 @@ jobs:
8585
# queries: ./path/to/local/query, your-org/your-repo/queries@main
8686
- run: ./gradlew -x test assembleReleaseJar
8787
- name: Perform CodeQL Analysis
88-
uses: github/codeql-action/analyze@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a # v4.36.3
88+
uses: github/codeql-action/analyze@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0

.github/workflows/release-validated.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
fetch-depth: 0
4444

4545
- name: Setup Java
46-
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
46+
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
4747
with:
4848
distribution: 'zulu'
4949
java-version: '21'
@@ -204,7 +204,7 @@ jobs:
204204
git checkout $GITHUB_REF_NAME
205205
206206
- name: Setup Java
207-
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
207+
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
208208
with:
209209
distribution: 'zulu'
210210
java-version: '21'

build-logic/conventions/src/main/kotlin/com/datadoghq/native/config/ConfigurationPresets.kt

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object ConfigurationPresets {
5151
configureTsan(this, currentPlatform, currentArch, version, rootDir, compiler)
5252
}
5353
register("fuzzer") {
54-
configureFuzzer(this, currentPlatform, currentArch, version, rootDir)
54+
configureFuzzer(this, currentPlatform, currentArch, version, rootDir, compiler)
5555
}
5656
}
5757

@@ -313,7 +313,8 @@ object ConfigurationPresets {
313313
platform: Platform,
314314
architecture: Architecture,
315315
version: String,
316-
rootDir: File
316+
rootDir: File,
317+
compiler: String = "gcc"
317318
) {
318319
config.platform.set(platform)
319320
config.architecture.set(architecture)
@@ -339,7 +340,28 @@ object ConfigurationPresets {
339340
when (platform) {
340341
Platform.LINUX -> {
341342
config.compilerArgs.set(fuzzerCompilerArgs + commonLinuxCompilerArgs(version))
342-
config.linkerArgs.set(commonLinuxLinkerArgs() + fuzzerLinkerArgs)
343+
344+
// commonLinuxLinkerArgs() carries -Wl,-z,defs, which forbids the
345+
// undefined __asan_*/__ubsan_* symbols the instrumented objects
346+
// reference. -fsanitize=address only links the runtime into
347+
// executables, not shared libraries, so the fuzzer .so needs the
348+
// runtime linked explicitly — same treatment (and rationale) as the
349+
// asan config. On clang this resolves both __asan_* and __ubsan_*
350+
// from one clang_rt.asan runtime; on gcc it adds -lubsan.
351+
val libasan = PlatformUtils.locateLibasan(compiler)
352+
val fuzzerRuntimeArgs = if (libasan != null) {
353+
val asanLibDir = File(libasan).parent
354+
val asanLibName = File(libasan).nameWithoutExtension.removePrefix("lib")
355+
val ubsanLibs = if (asanLibName.startsWith("clang_rt")) emptyList()
356+
else listOf("-lubsan")
357+
listOf("-L$asanLibDir", "-l$asanLibName",
358+
"-Wl,-rpath,$asanLibDir") +
359+
ubsanLibs +
360+
fuzzerLinkerArgs
361+
} else {
362+
fuzzerLinkerArgs
363+
}
364+
config.linkerArgs.set(commonLinuxLinkerArgs() + fuzzerRuntimeArgs)
343365

344366
config.testEnvironment.apply {
345367
put("ASAN_OPTIONS", "allocator_may_return_null=1:detect_stack_use_after_return=0:handle_segv=0:abort_on_error=1:symbolize=1:suppressions=$rootDir/gradle/sanitizers/asan.supp")

0 commit comments

Comments
 (0)