Skip to content

20260615-linuxkm-fixes#10696

Open
douzzer wants to merge 2 commits into
wolfSSL:masterfrom
douzzer:20260615-linuxkm-fixes
Open

20260615-linuxkm-fixes#10696
douzzer wants to merge 2 commits into
wolfSSL:masterfrom
douzzer:20260615-linuxkm-fixes

Conversation

@douzzer

@douzzer douzzer commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

fixes for false positives on linuxkm CONFIG_FORTIFY_SOURCE builds on gcc-16:

linuxkm/linuxkm_memory.c: use packed-struct intermediates rather than memcpy()s for wc_get_unaligned() and wc_put_unaligned().

linuxkm/linuxkm_wc_port.h: on old FIPS, retrofit nonnull attribute to GHASH() arg 1, so that it unconditionally writes out the hash.

wolfcrypt/src/aes.c and wolfssl/wolfcrypt/aes.h: in GHASH(), add nonnull attribute to arg 1, and remove runtime nullness check for arg 1 in the implementations.

linuxkm/lkcapi_sha_glue.c: refactor error code handling in wc_linuxkm_drbg_generate() (followup to 3c9996e in #10688).

…gcc-16:

linuxkm/linuxkm_memory.c: use packed-struct intermediates rather than memcpy()s for wc_get_unaligned() and wc_put_unaligned().

linuxkm/linuxkm_wc_port.h: on old FIPS, retrofit nonnull attribute to GHASH() arg 1, so that it unconditionally writes out the hash.

wolfcrypt/src/aes.c and wolfssl/wolfcrypt/aes.h: in GHASH(), add nonnull attribute to arg 1, and remove runtime nullness check for arg 1 in the implementations.

@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 #10696

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

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread linuxkm/lkcapi_sha_glue.c
@douzzer douzzer force-pushed the 20260615-linuxkm-fixes branch from abfe536 to 2844cd1 Compare June 16, 2026 17:29
@douzzer

douzzer commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

retest this please
(unrelated FIPS glitch)

@douzzer douzzer removed their assignment Jun 17, 2026
@philljj

philljj commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Nice, this fixes linuxkm-aesni-insmod-kmemleak gcc-16 false positive failure on master.

@philljj philljj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tests good, just some nits in review.

Comment thread linuxkm/linuxkm_wc_port.h
unsigned int cSz, unsigned char* s, unsigned int sSz);
#else
struct Gcm;
WOLFSSL_LOCAL void __attribute__((nonnull(1))) GHASH(struct Gcm *gcm, const unsigned char* a,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dumb question, is this redundant with the change in aes.h?

Also can WC_ARG_NOT_NULL be used here?

@douzzer douzzer Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not on old FIPS -- that's what it's for.

And WC_ARG_NOT_NULL doesn't exist yet when linuxkm_wc_port.h is evaluated, alas. That's why it's also using unsigned char * instead of byte *, etc.

Comment thread linuxkm/lkcapi_sha_glue.c
if (unlikely(ret == WC_NO_ERR_TRACE(RNG_FAILURE_E))) {
if (slen > 0) {
ret = -EINVAL;
if (slen > 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: could condense this to if (slen > 0 || retried) break; now.

Of if they are worth being separate checks, maybe a short 1 line comment explaining what slen > 0 vs retried means in error conditions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Need to be separate so that instrumentation (--enable-debug-trace-errcodes) shows what failed.

IIRC, the slen situation isn't retryable because the whole point of a gen paired with a seed is to have the seed deterministically determine what's gen'd, which it wouldn't if a reinit were done midstream. This could be bikeshedded to work right on reinit but clearly isn't worth the extra trouble.

@douzzer douzzer requested a review from philljj June 17, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Not For This Release Not for release 5.9.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants