Skip to content

20260904-linuxkm-misc - #11382

Merged
JacobBarthelmeh merged 25 commits into
wolfSSL:masterfrom
douzzer:20260904-linuxkm-misc
Sep 11, 2026
Merged

JacobBarthelmeh merged 25 commits into
wolfSSL:masterfrom
douzzer:20260904-linuxkm-misc

Conversation

@douzzer

@douzzer douzzer commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

linuxkm/linuxkm_wc_port.h:

  • reduce WC_LINUXKM_MAX_NS_WITHOUT_YIELD from 1 second to 25 ms for better kernel citizenship.
  • add WC_DEBUG_FORCE_KERNEL_SETTINGS for inhibiting #errors on unsupported configurations.
  • add __extension__ annotation to macros that need it.
  • add wc_svr_disallowed_count_reset() and wc_svr_disallowed_count_current().
  • fix CAN_SAVE_VECTOR_REGISTERS() to honor DEBUG_VECTOR_REGISTER_ACCESS_ALWAYS_{ON,OFF}.
  • add WC_RELAX_LONG_LOOP() to DEBUG_VECTOR_REGISTER_ACCESS_ALWAYS_OFF variant of SAVE_VECTOR_REGISTERS2().
  • allow for fully user-supplied SAVE_VECTOR_REGISTERS() and friends.

linuxkm/module_hooks.c:

  • add WOLFSSL_DEBUG_TRACE_ERROR_CODES coverage for all system error codes used by module_hooks.c and its includes.
  • implement double-run wolfCrypt_IntegrityTest_fips() and wc_RunAllCast_fips() in WC_C_DYNAMIC_FALLBACK configurations, once with acceleration on (leveraging fallback instrumentation to fail the module if any fallbacks occur), and once with it forced off using DISABLE_VECTOR_REGISTERS().

linuxkm/module_hooks.c: when DEBUG_VECTOR_REGISTER_ACCESS_FUZZING or DEBUG_VECTOR_REGISTER_ACCESS_ALWAYS_ON, inhibit DISABLE_VECTOR_REGISTERS() exercises and auditing of wc_svr_disallowed_count_current().

linuxkm/module_hooks.c: implement /sys/module/libwolfssl/FIPS_optest_run_code_audit_accel and /sys/module/libwolfssl/FIPS_optest_run_code_audit_c.

linuxkm/module_hooks.c: in wolfssl_init(), when WOLFSSL_AESNI but not USE_INTEL_SPEEDUP, don't expect wc_svr_disallowed_count_current() to increase for wolfCrypt_IntegrityTest_fips() (no AES in it).

linuxkm/module_hooks.c and wolfcrypt/src/rng_bank.c: fixes for external review of FIPS_OPTEST/LKCAPI coexistence and affinity lock error handling.

in FIPS_optest_trig_handler(), implement assiduous (atomic-based) mutual exclusion with LKCAPI registration.

in wc_rng_bank_checkout(), propagate INTERRUPTED_E from bank->affinity_lock_cb rather than swallowing it -- caller-requested interruption must abort checkout, consistent with the WC_CHECK_FOR_INTR_SIGNALS() handling in the same loop; other affinity lock errors continue to be tolerated (affinity is advisory).

linuxkm/linuxkm-fips-hash.c: in hmac_update_cb(), use wc_HmacUpdate(), not wc_HmacUpdate_fips(), for compatibility with dev-no-post.

linuxkm/lkcapi_glue.c: tolerate !HAVE_FIPS with CONFIG_CRYPTO_FIPS, with a runtime check that kernel fips_enabled is zero.

linuxkm/module_hooks.c:

  • add libwolfssl_inited flag variable and use it for proper error-path cleanup;

  • call wc_linuxkm_allocate_svr_states() and wc_linuxkm_free_svr_states() explicitly in FIPS builds (avoid atomic-context synchronous call to wc_linuxkm_allocate_svr_states() via fipEntry());

  • add missing WOLFSSL_FIPS_DEV_NO_POST gates;

  • in wc_lkm_LockMutex(), return BUSY_E immediately if in_nmi().

tested with

wolfssl-multi-test.sh ...
check-source-text
quantum-safe-wolfssl-all-crypto-only-intelasm-sp-asm-fips-dev-linuxkm-next-clang-tidy
quantum-safe-wolfssl-all-crypto-only-intelasm-sp-asm-sp-linuxkm-6.12-insmod
quantum-safe-wolfssl-all-crypto-only-intelasm-sp-asm-fips-dev-linuxkm-next-insmod
linuxkm-6.15-all-cryptonly-quantum-safe-allintelasm-LKCAPI-insmod-crypto-fuzzer-kmemleak
linuxkm-6.15-all-cryptonly-quantum-safe-allintelasm-LKCAPI-insmod-crypto-fuzzer-ksan
linuxkm-fips-dev-insmod-wolfguard-cust-kernel-3

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

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

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

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Comment thread linuxkm/linuxkm_wc_port.h Resolved
Comment thread linuxkm/module_hooks.c Resolved
@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

@philljj philljj assigned douzzer and unassigned wolfSSL-Bot Sep 6, 2026
@douzzer
douzzer force-pushed the 20260904-linuxkm-misc branch from 2c52057 to 8864af4 Compare September 10, 2026 04:37
Comment thread linuxkm/linuxkm_wc_port.h Resolved
Comment thread linuxkm/module_hooks.c Resolved

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

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

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

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Comment thread linuxkm/lkcapi_aes_glue.c Resolved
Comment thread linuxkm/module_hooks.c Resolved
Comment thread linuxkm/module_hooks.c Resolved

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

Scan targets checked: linuxkm-src, linuxkm-bugs, wolfssl-src, wolfssl-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs

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

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Comment thread linuxkm/lkcapi_aes_glue.c Resolved
Comment thread linuxkm/lkcapi_aes_glue.c Resolved
* reduce WC_LINUXKM_MAX_NS_WITHOUT_YIELD from 1 second to 25 ms for better kernel citizenship.
* add WC_DEBUG_FORCE_KERNEL_SETTINGS for inhibiting #errors on unsupported configurations.
* add __extension__ annotation to macros that need it.
* add wc_svr_disallowed_count_reset() and wc_svr_disallowed_count_current().
* fix CAN_SAVE_VECTOR_REGISTERS() to honor DEBUG_VECTOR_REGISTER_ACCESS_ALWAYS_{ON,OFF}.
* add WC_RELAX_LONG_LOOP() to DEBUG_VECTOR_REGISTER_ACCESS_ALWAYS_OFF variant of SAVE_VECTOR_REGISTERS2().
* allow for fully user-supplied SAVE_VECTOR_REGISTERS() and friends.
* add WOLFSSL_DEBUG_TRACE_ERROR_CODES coverage for all system error codes used by module_hooks.c and its includes.
* implement double-run wolfCrypt_IntegrityTest_fips() and wc_RunAllCast_fips() in WC_C_DYNAMIC_FALLBACK configurations, once with acceleration on (leveraging fallback instrumentation to fail the module if any fallbacks occur), and once with it forced off using DISABLE_VECTOR_REGISTERS().
…DEBUG_VECTOR_REGISTER_ACCESS_ALWAYS_ON, inhibit DISABLE_VECTOR_REGISTERS() exercises and auditing of wc_svr_disallowed_count_current().
…run_code_audit_accel and /sys/module/libwolfssl/FIPS_optest_run_code_audit_c.
… USE_INTEL_SPEEDUP, don't expect wc_svr_disallowed_count_current() to increase for wolfCrypt_IntegrityTest_fips() (no AES in it).
…PI coexistence: in FIPS_optest_trig_handler(), implement assiduous (atomic-based) mutual exclusion with LKCAPI registration.
…, not wc_HmacUpdate_fips(), for compatibility with dev-no-post.
…ith a runtime check that kernel fips_enabled is zero.
* add libwolfssl_inited flag variable and use it for proper error-path cleanup;

* call wc_linuxkm_allocate_svr_states() and wc_linuxkm_free_svr_states() explicitly in FIPS builds (avoid atomic-context synchronous call to wc_linuxkm_allocate_svr_states() via fipEntry());

* add missing WOLFSSL_FIPS_DEV_NO_POST gates;

* in wc_lkm_LockMutex(), return BUSY_E immediately if in_nmi().
…batching several chunks within a single SAVE_VECTOR_REGISTERS2() bracket (entails adding WALK_ATOMIC to calls that affect walk dynamics during the locked batches).
…ERROR_CODES_PER_FILE and WOLFSSL_DEBUG_TRACE_ERROR_CODES_THIS_FILE (file-scoped code traces).
…WOLFSSL_ATOMIC_LOAD() and WOLFSSL_ATOMIC_STORE(), use __ATOMIC_SEQ_CST rather than __ATOMIC_CONSUME/__ATOMIC_RELEASE, for consistency with semantics of the primary C11 bindings to atomic_load() and atomic_store().
…rly, and add WC_LINUXKM_HAVE_MY_KALLSYMS_LOOKUP_NAME.
…S_optest_trig_audit_c_attr to use distinct handlers that pass distinct mode arguments to a multi-personality FIPS_optest_trig_common(), properly implementing the SVR-auditing variants of the FIPS_optest_run_code sysfs node.
…ECTOR_REGISTER_ACCESS_ALWAYS_{OFF,ON} settings.
* always call wolfCrypt_Init() directly, even in TLS builds, to assure
  mutex-free scheduler context during allocations;

* convert sysfs nodes from struct kobj_attribute to struct module_attribute,
  matching the module_sysfs_ops dispatch on THIS_MODULE->mkobj.kobj, for
  compatibility with CONFIG_CFI_CLANG (kCFI) kernels.
…ase batch

  opening, leaving just the existing batch opening inside the main crypt loop, to
  avoid unnecessary atomic-context allocations in the preamble;

linuxkm/module_hooks.c:

* add wc_linuxkm_deinstall(), which idempotently deregisters all algorithms and
  sysfs nodes, and call it from libwolfssl_cleanup() and wolfssl_exit();

* refactor in_optest atomic flag (local to FIPS_optest_trig_common()) to
  file-scoped in_fips_test, and use it as a mutex for both
  FIPS_rerun_self_test_handler() and FIPS_optest_trig_common().
… exclusion gate for test clauses that depends on new fixes (implicit public key rederivation on import etc.).

add missing && !defined(NO_TLS) gate to test_wolfSSL_certs_clear().

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

Scan targets checked: linuxkm-src, linuxkm-bugs, wolfcrypt-src, wolfcrypt-bugs
Unchanged since last review (not re-run): wolfssl-src, wolfssl-bugs

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

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Comment thread linuxkm/lkcapi_aes_glue.c Resolved
…IG_PREEMPT_RT (walk/map paths must run preemptible with that config).
…for correct error-path unwind, and use it in wc_HmacFree() for all deallocation. Fixes F-8163 -- "wc_HmacCopy shallow-copies the cached inner and outer hash contexts".

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

Scan targets checked: linuxkm-src, linuxkm-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed stale reviews from themself September 10, 2026 21:09

Fenrir's latest completed scan found no issues; clearing the prior automated change request.

@SparkiDev

Copy link
Copy Markdown
Contributor

Jenkins: retest this please

@douzzer douzzer mentioned this pull request Sep 10, 2026
@douzzer

douzzer commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

The Jenkins failure is on the new FIPS v6 tests, on sanitizing optest, and is presumptively nothing to do with this PR.

FWIW this PR was tested here on FIPS v6, and has FIPS v6 fixes in it!

@douzzer douzzer added the For This Release Release version 5.9.4 label Sep 11, 2026
@douzzer

douzzer commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

retest this please
(retrying FIPS v6 tests)

@JacobBarthelmeh
JacobBarthelmeh merged commit ea749a6 into wolfSSL:master Sep 11, 2026
403 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants