@@ -100,25 +100,31 @@ jobs:
100100 - name : Test
101101 if : steps.set_enabled.outputs.enabled == 'true'
102102 run : |
103- # Reduce ASLR entropy so the JVM doesn't land in ASan's shadow range
104- # [0x00007fff7000-0x10007fff7fff]; 28 (the default) causes random aborts.
105- sudo sysctl vm.mmap_rnd_bits=8
106-
107103 set +e
108104 export KEEP_JFRS=true
109105 export TEST_COMMIT=${{ github.sha }}
110106 export TEST_CONFIGURATION=glibc/${{ matrix.java_version }}-${{ matrix.config }}-amd64
111107 export LIBC=glibc
112108 export SANITIZER=${{ matrix.config }}
113109
110+ GRADLEW_PREFIX=""
111+ if [[ "${{ matrix.config }}" == "asan" ]]; then
112+ # Reduce ASLR entropy so the JVM doesn't land in ASan's shadow range
113+ # [0x00007fff7000-0x10007fff7fff]; 28 (the default) causes random aborts.
114+ if ! sudo sysctl -w vm.mmap_rnd_bits=8 2>/dev/null; then
115+ echo "::warning::Cannot set vm.mmap_rnd_bits; falling back to setarch --addr-no-randomize"
116+ GRADLEW_PREFIX="setarch $(uname -m) --addr-no-randomize"
117+ fi
118+ fi
119+
114120 MAX_ATTEMPTS=1
115121 if [[ "${{ matrix.config }}" == "asan" && "${{ matrix.java_version }}" =~ (j9|ibm) ]]; then
116122 MAX_ATTEMPTS=2
117123 fi
118124
119125 for attempt in $(seq 1 $MAX_ATTEMPTS); do
120126 mkdir -p build/logs
121- ./gradlew -PCI -PkeepJFRs ${{ inputs.skip_gtest == true && '-Pskip-gtest' || '' }} :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs 2>&1 \
127+ ${GRADLEW_PREFIX} ./gradlew -PCI -PkeepJFRs ${{ inputs.skip_gtest == true && '-Pskip-gtest' || '' }} :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs 2>&1 \
122128 | tee -a build/test-raw.log \
123129 | python3 -u .github/scripts/filter_gradle_log.py
124130 EXIT_CODE=${PIPESTATUS[0]}
@@ -375,19 +381,22 @@ jobs:
375381 - name : Test
376382 if : steps.set_enabled.outputs.enabled == 'true'
377383 run : |
378- # Reduce ASLR entropy so the JVM doesn't land in ASan's shadow range; 28 causes random aborts.
379- sudo sysctl vm.mmap_rnd_bits=8
380-
381384 set +e
382385 export KEEP_JFRS=true
383386 export TEST_COMMIT=${{ github.sha }}
384387 export TEST_CONFIGURATION=glibc/${{ matrix.java_version }}-${{ matrix.config }}-aarch64
385388 export LIBC=glibc
386389 export SANITIZER=${{ matrix.config }}
387390
391+ GRADLEW_PREFIX=""
388392 # For ASAN: launch a gdb watchdog that dumps all native threads before the
389393 # 30-minute Gradle timeout kills the JVM, so we can diagnose hangs in native code.
390394 if [[ "${{ matrix.config }}" == "asan" ]]; then
395+ # Reduce ASLR entropy so the JVM doesn't land in ASan's shadow range; 28 causes random aborts.
396+ if ! sudo sysctl -w vm.mmap_rnd_bits=8 2>/dev/null; then
397+ echo "::warning::Cannot set vm.mmap_rnd_bits; falling back to setarch --addr-no-randomize"
398+ GRADLEW_PREFIX="setarch $(uname -m) --addr-no-randomize"
399+ fi
391400 mkdir -p build/logs
392401 (
393402 sleep 1500 # 25 minutes — fires before the 30-min Gradle timeout
@@ -407,7 +416,7 @@ jobs:
407416
408417 for attempt in $(seq 1 $MAX_ATTEMPTS); do
409418 mkdir -p build/logs
410- ./gradlew -PCI -PkeepJFRs ${{ inputs.skip_gtest == true && '-Pskip-gtest' || '' }} :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs 2>&1 \
419+ ${GRADLEW_PREFIX} ./gradlew -PCI -PkeepJFRs ${{ inputs.skip_gtest == true && '-Pskip-gtest' || '' }} :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs 2>&1 \
411420 | tee -a build/test-raw.log \
412421 | python3 -u .github/scripts/filter_gradle_log.py
413422 EXIT_CODE=${PIPESTATUS[0]}
0 commit comments