Skip to content

Use atomics for write-dup mailbox state - #11005

Open
be0hhh wants to merge 1 commit into
wolfSSL:masterfrom
be0hhh:fix/write-dup-atomic-mailbox
Open

Use atomics for write-dup mailbox state#11005
be0hhh wants to merge 1 commit into
wolfSSL:masterfrom
be0hhh:fix/write-dup-atomic-mailbox

Conversation

@be0hhh

@be0hhh be0hhh commented Jul 29, 2026

Copy link
Copy Markdown

Description

Use wolfSSL's portable atomic integer operations for the simple TLS write-dup error and KeyUpdate mailbox state when atomic operations are available.

The mutex remains responsible for lifetime and reference-count state. Configurations with DTLS 1.3 or post-handshake authentication retain the existing mutex mailbox path because they carry additional compound state and ownership.

This removes the explicit per-write mailbox mutex on the supported atomic path without changing the public API or the mailbox's level-triggered semantics.

Testing

  • GCC RelWithDebInfo: write-dup API tests passed.
  • Clang RelWithDebInfo: write-dup API tests passed.
  • GCC with atomic operations disabled: existing write-dup tests passed and the atomic-only test was skipped.
  • ASan and UBSan: write-dup API tests passed.
  • DTLS 1.2 and DTLS 1.3 configuration: write-dup API tests passed on the retained mutex path.
  • Post-handshake authentication configuration: library and unit-test binary built on the retained mutex path; the existing certificate-chain assertions fail identically on unmodified master.
  • Full GCC unit suite: passed.
  • Added a concurrent producer/consumer regression test for error publication and KeyUpdate take/post behavior.
  • Ran the source-text hygiene check on all changed files.

ThreadSanitizer builds successfully after demoting its existing atomic_thread_fence warning, but its runtime exits before test execution in this WSL environment with unexpected memory mapping.

Checklist

  • added tests
  • updated/added doxygen: not applicable; internal-only change
  • updated appropriate READMEs: not applicable
  • Updated manual and documentation: not applicable

@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@dgarske

dgarske commented Jul 29, 2026

Copy link
Copy Markdown
Member

Hi @be0hhh , thank you for the code contribution. Can you tell us more about your project and interest in our library? To be an external contributor we require a signed agreement. If you are willing to do this please email support at wolfssl dot com and include your physical location and details about your project/interests and a link the your active PR(s).
Thanks, David Garske, wolfSSL

@be0hhh

be0hhh commented Jul 29, 2026

Copy link
Copy Markdown
Author

Thank you, David.
I am willing to review and sign the individual contributor agreement. I have emailed support@wolfssl.com.
Please let me know if you need any additional information.

Best regards,
be0hhh

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