Skip to content

Fix mem-fail nightly crashes (jenkins-supervisor #501) - #11092

Open
sameehj wants to merge 1 commit into
wolfSSL:masterfrom
sameehj:fix/mem-fail-null-checks
Open

Fix mem-fail nightly crashes (jenkins-supervisor #501)#11092
sameehj wants to merge 1 commit into
wolfSSL:masterfrom
sameehj:fix/mem-fail-null-checks

Conversation

@sameehj

@sameehj sameehj commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes crashes found by the mem-fail Jenkins nightly
([open issue 501].

That job fails the Nth allocation via MEM_FAIL_CNT and treats segfault
(139) / abort (134) as product findings. In these cases the library often
returned a clean error (e.g. NULL from XMALLOC), but the unit tests kept
running bare statements after an Expect* failure and touched NULL or
uninitialised state.

  • test_wolfSSL_X509_VERIFY_PARAM (shard 2, fail at 2/3 and 3/3):
    After X509_VERIFY_PARAM_new() returns NULL, guard bare
    paramTo / paramFrom writes (inherit_flags, XMEMSET, etc.).

  • test_wc_Sakke_FeatureCoverage / test_wc_Sakke_DecisionCoverage
    (shards 0 and 3): Zero-init rng / key / key2 so wc_FreeSakkeKey
    is not called on stack garbage when init fails. Also make
    wc_FreeSakkeKey clear freed pointers / mpInit so a second free after
    a failed init path is a no-op.

  • test_wolfSSL_Tls13_ECH_wire_sni (shard 0, fail around 3147/6295):
    Do not dereference test_ctx.c_ctx when test_ssl_memio_setup failed.

Fixes zd#

Testing

Built with the mem-fail configure line (--enable-memorylog,
WOLFSSL_MEM_FAIL_COUNT).

  • Baseline (no MEM_FAIL_CNT): all four tests pass; alloc/free counts
    balance.
  • test_wolfSSL_X509_VERIFY_PARAM: MEM_FAIL_CNT=1..3 → exit 1 (was
    139 at 2 and 3).
  • SAKKE Feature + Decision: full injection sweeps (820 and 818) → no
    crash / abort; alloc/free balance OK.
  • test_wolfSSL_Tls13_ECH_wire_sni: all 484 previously crashing indices
    (locally 3166–4628) → exit 1; A/B at 3166: without fix 139, with fix 1.

Left for later (not mem-fail NULL-deref class): RPK baseline failures,
LMS Linux-only SIGILL at baseline.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

The mem-fail Jenkins job fails allocation N via MEM_FAIL_CNT and treats
segfault/abort as product findings. Several unit tests still touched
NULL or uninitialised state after an Expect* failure, so the job went
red even when the library returned a clean error.

- test_wolfSSL_X509_VERIFY_PARAM (shard 2, fail at 2/3 and 3/3):
  Guard bare paramTo/paramFrom writes after X509_VERIFY_PARAM_new()
  returns NULL.

- test_wc_Sakke_FeatureCoverage / DecisionCoverage (shards 0 and 3):
  Zero-init rng/key/key2 so FreeSakkeKey is not called on stack garbage
  when init fails. Make wc_FreeSakkeKey clear freed pointers so a second
  free after a failed init is safe.

- test_wolfSSL_Tls13_ECH_wire_sni (shard 0, fail around 3147/6295):
  Do not dereference test_ctx.c_ctx when memio setup failed.

Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #11092

Scan targets checked: wolfcrypt-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants