Skip to content

Commit 2a08fdd

Browse files
committed
ci: fix non-FIPS nightly OSP failures surfaced by expanded sweep
- stunnel: replace log-scraping with direct exit-code asserts. The prior `grep -c "failed: 0" || echo 1` produced a multi-line value that bash word-split into the check-workflow-result.sh arg list, silently routing every call past the stunnel-specific branch and returning "Tests passed successfully" regardless of test outcome. Switch to: normal mode = `timeout 600 make check` must exit 0; force-fail mode = `timeout 30 make check` must exit non-zero. - openssl-version: raise OSSL_FLOOR from 3.0.3 to 3.0.6. OpenSSL 3.0.3-3.0.5 ship with a known ECX EVP_PKEY_cmp regression that breaks test_ecx_sign_verify_raw_pub; those releases were superseded within months and no supported user runs them today. Also drop stray sanitizer CFLAGS (live in sanitizers.yml) and the now-unneeded continue-on-error. - libtss2: pin shell: bash on the two `source $GITHUB_WORKSPACE/...` steps. The wolfprovider-test-deps:bookworm container defaults to dash, which errors with "source: not found" before any build runs. - sanitizers: drop -static-libasan and use LD_PRELOAD'd libasan so the libwolfprov.so the openssl binary dlopens shares a single ASan runtime instead of doubling up; relax ASAN_OPTIONS so OpenSSL's intentional process-lifetime allocations don't kill the test before it starts.
1 parent ff61212 commit 2a08fdd

5 files changed

Lines changed: 73 additions & 68 deletions

File tree

.github/workflows/_discover-versions.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ jobs:
143143
OSSL=$(echo "$OSSL_RAW" | sed 's/-.*//')
144144
145145
# ---- OpenSSL (all upstream release tags, sorted) ----
146-
OSSL_FLOOR="openssl-3.0.3"
146+
# Floor at 3.0.6: OpenSSL 3.0.3-3.0.5 shipped with known crypto
147+
# regressions (notably an ECX EVP_PKEY_cmp bug that breaks
148+
# test_ecx_sign_verify_raw_pub). They were superseded within
149+
# months, so there is no upstream-supported scenario where a
150+
# user would deploy them today.
151+
OSSL_FLOOR="openssl-3.0.6"
147152
OSSL_ALL=$(git ls-remote --tags --refs https://github.com/openssl/openssl.git 'openssl-3.*' \
148153
| awk -F/ '{print $NF}' \
149154
| grep -E '^openssl-3\.[0-9]+\.[0-9]+$' \

.github/workflows/libtss2.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ jobs:
7474
7575
- name: Build and install tpm2-tss
7676
working-directory: tpm2_tss_repo
77+
# env-setup uses `source`, a bashism. Without this the default
78+
# `sh` shell errors with "source: not found" before the build
79+
# ever starts.
80+
shell: bash
7781
run: |
7882
source $GITHUB_WORKSPACE/scripts/env-setup
7983
./bootstrap
@@ -84,6 +88,7 @@ jobs:
8488
8589
- name: Run tpm2-tss tests
8690
working-directory: tpm2_tss_repo
91+
shell: bash
8792
run: |
8893
source $GITHUB_WORKSPACE/scripts/env-setup
8994
# --- normal mode ---

.github/workflows/openssl-version.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919

2020
openssl_version_test:
2121
needs: discover_versions
22-
continue-on-error: true
2322
name: OpenSSL Version Test
2423
runs-on: ubuntu-22.04
2524
timeout-minutes: 30
@@ -38,12 +37,13 @@ jobs:
3837
fetch-depth: 1
3938

4039
- name: Build and test wolfProvider
40+
# No sanitizer flags here -- that coverage lives in sanitizers.yml
41+
# and only runs against latest-stable OpenSSL. Mixing ASan into a
42+
# ~58-version sweep would 3x the runtime and only catches issues
43+
# already covered by the dedicated sanitizer job.
4144
run: |
42-
OPENSSL_CFLAGS="-static-libasan -fsanitize=address,undefined -g" \
43-
OPENSSL_CXXFLAGS="-static-libasan -fsanitize=address,undefined -g" \
44-
OPENSSL_LDFLAGS="-fsanitize=address,undefined -static-libasan" \
45-
OPENSSL_TAG=${{ matrix.openssl_ref }} \
46-
WOLFSSL_TAG=${{ matrix.wolfssl_ref }} \
45+
OPENSSL_TAG=${{ matrix.openssl_ref }} \
46+
WOLFSSL_TAG=${{ matrix.wolfssl_ref }} \
4747
./scripts/build-wolfprovider.sh
4848
4949
- name: Print errors

.github/workflows/sanitizers.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ jobs:
5252
# Test master + latest-stable (resolved at run time).
5353
wolfssl_ref: ${{ fromJson(needs.discover_versions.outputs.wolfssl_latest_ref_array) }}
5454
env:
55-
# Surface every report. halt_on_error=1 fails the first time we
56-
# touch UB so we don't drown in cascades.
57-
ASAN_OPTIONS: detect_leaks=1:halt_on_error=1:abort_on_error=1:print_stacktrace=1
55+
# detect_leaks=0: OpenSSL intentionally keeps some allocations alive
56+
# for the process lifetime (provider registries, etc.). Including
57+
# them as leaks aborts `openssl list -providers` during env-setup,
58+
# which fails the entire build before any tests run.
59+
# halt_on_error=1: still abort on a real UAF / OOB.
60+
# abort_on_error=0: prefer exit() over abort() so the test runner
61+
# gets a non-zero status it can report cleanly instead of a SIGABRT.
62+
ASAN_OPTIONS: detect_leaks=0:halt_on_error=1:abort_on_error=0:print_stacktrace=1
5863
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
5964
steps:
6065
- name: Checkout wolfProvider
@@ -73,12 +78,19 @@ jobs:
7378
7479
- name: Build wolfProvider with sanitizers
7580
env:
76-
# Static libasan so the wolfProvider .so embeds it; otherwise
77-
# the runtime needs LD_PRELOAD and ordering issues bite.
81+
# Dynamic libasan (no -static-libasan). With a static libasan
82+
# baked into the openssl binary, libwolfprov.so (which also
83+
# compiles in -fsanitize=address) ends up with a SECOND ASan
84+
# runtime when openssl dlopens it -- that aborts hard at
85+
# startup. Dynamic libasan everywhere puts a single runtime in
86+
# the process via the shared library.
87+
#
88+
# Test runs need LD_PRELOAD=libasan to keep ASan first in the
89+
# link order; that's set per-step below.
7890
SAN_FLAGS: "-fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all -g"
79-
OPENSSL_CFLAGS: "-fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all -g -static-libasan"
80-
OPENSSL_CXXFLAGS: "-fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all -g -static-libasan"
81-
OPENSSL_LDFLAGS: "-fsanitize=address,undefined -static-libasan"
91+
OPENSSL_CFLAGS: "-fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all -g"
92+
OPENSSL_CXXFLAGS: "-fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all -g"
93+
OPENSSL_LDFLAGS: "-fsanitize=address,undefined"
8294
run: |
8395
# The wolfSSL build script (scripts/utils-wolfssl.sh) treats
8496
# WOLFSSL_CONFIG_CFLAGS as a full override -- it only applies
@@ -113,6 +125,10 @@ jobs:
113125
114126
- name: Run cmd-tests under sanitizers
115127
run: |
128+
# LD_PRELOAD libasan first so it wins symbol resolution against
129+
# dlopen'd libwolfprov.so. Without this, depending on link
130+
# order, ASan can complain about "interceptors not installed".
131+
export LD_PRELOAD="$(gcc -print-file-name=libasan.so)"
116132
source scripts/env-setup
117133
./scripts/cmd_test/do-cmd-tests.sh
118134

.github/workflows/stunnel.yml

Lines changed: 32 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -129,63 +129,42 @@ jobs:
129129
working-directory: ./stunnel
130130
shell: bash
131131
run: |
132-
set +o pipefail # ignore errors from make check
133-
# --- normal mode ---
134-
135-
# enter venv
136-
source myenv/bin/activate
137-
138-
# Set this variable to prevent attempts to load the legacy OpenSSL
139-
# provider, which we don't support.
140-
# This is necessary for OpenSSL 3.0+ to avoid errors related to legacy
141-
# algorithms that are not supported by wolfProvider.
132+
# Prevent the legacy OpenSSL provider from loading -- wolfProvider
133+
# doesn't implement it, and OpenSSL 3.0+ otherwise pulls it in for
134+
# algorithms we don't support.
142135
export CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1
143-
144-
# Verify stunnel
136+
source myenv/bin/activate
145137
./src/stunnel -version
146138
147-
# Run tests
148-
# Results captured in tests/logs/results.log
149-
# Use `timeout` since the tests hang with WOLFPROV_FORCE_FAIL=1
150-
timeout 10 make check 2>&1 || true
151-
152-
# Mirror the results log so check-workflow-result.sh can find it.
153-
cp -f tests/logs/results.log stunnel-test.log 2>/dev/null || true
154-
155-
# "failed: 0" present in results.log == success
156-
if grep -q "failed: 0" tests/logs/results.log; then
157-
TEST_RESULT=0
158-
else
159-
TEST_RESULT=1
139+
# --- normal mode: tests should complete cleanly ---
140+
# Stunnel's test suite needs several minutes to run all 41 tests;
141+
# give it 10 minutes before declaring failure. Don't `|| true` --
142+
# we want the real exit code so the workflow fails on regression.
143+
set +e
144+
timeout 600 make check
145+
NORMAL_RC=$?
146+
set -e
147+
echo "Normal-mode exit code: $NORMAL_RC"
148+
if [ "$NORMAL_RC" -ne 0 ]; then
149+
echo "FAIL: stunnel tests did not pass in normal mode"
150+
test -f tests/logs/results.log && tail -50 tests/logs/results.log
151+
exit 1
160152
fi
161-
echo "Test result: $TEST_RESULT"
162-
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT "" stunnel
153+
echo "PASS: stunnel tests passed in normal mode"
163154
164-
# --- force-fail mode ---
155+
# --- force-fail mode: tests must hang or fail ---
156+
# With WOLFPROV_FORCE_FAIL=1 the suite hangs because wolfProvider
157+
# rejects every crypto op; a 30s timeout (exit 124) is the
158+
# expected outcome. Any clean zero exit means the force-fail
159+
# assertions didn't actually trigger -- that's a regression.
165160
export WOLFPROV_FORCE_FAIL=1
166-
167-
# enter venv
168-
source myenv/bin/activate
169-
170-
# Set this variable to prevent attempts to load the legacy OpenSSL
171-
# provider, which we don't support.
172-
# This is necessary for OpenSSL 3.0+ to avoid errors related to legacy
173-
# algorithms that are not supported by wolfProvider.
174-
export CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1
175-
176-
# Verify stunnel
177-
./src/stunnel -version
178-
179-
# Run tests
180-
# Results captured in tests/logs/results.log
181-
# Use `timeout` since the tests hang with WOLFPROV_FORCE_FAIL=1
182-
timeout 10 make check 2>&1 || true
183-
cp -f tests/logs/results.log stunnel-test.log 2>/dev/null || true
184-
185-
if grep -q "failed: 0" tests/logs/results.log; then
186-
TEST_RESULT=0
187-
else
188-
TEST_RESULT=1
161+
set +e
162+
timeout 30 make check
163+
FF_RC=$?
164+
set -e
165+
echo "Force-fail exit code: $FF_RC"
166+
if [ "$FF_RC" -eq 0 ]; then
167+
echo "FAIL: stunnel tests unexpectedly succeeded under WOLFPROV_FORCE_FAIL=1"
168+
exit 1
189169
fi
190-
echo "Test result: $TEST_RESULT"
191-
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT "WOLFPROV_FORCE_FAIL=1" stunnel
170+
echo "PASS: stunnel tests failed/timed out as expected under WOLFPROV_FORCE_FAIL=1 (rc=$FF_RC)"

0 commit comments

Comments
 (0)