Repository navigation
Silence -fsanitize=function for generic callback calls - #12217
Open
julek-wolfssl wants to merge 2 commits into
Open
julek-wolfssl wants to merge 2 commits into
julek-wolfssl wants to merge 2 commits into
Conversation
Typed free functions are called through void (*)(void *). The types are not compatible in C but the call is fine on supported ABIs. Add WC_NO_SANITIZE_FUNCTION to skip clang's check.
Stack hash, TXT_DB, ASN.1 item template and CTS128 callbacks are also called through generic pointer types.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The ASN.1 sanitizer suppression leaves d2i_generic_obj’s allocation-failure cleanup uncovered, so sequence decoding under memory pressure can still trigger a function-sanitizer report or abort.
1 open issue
What changed in this PR
This PR adds targeted Clang function-sanitizer suppression to generic callback callers in wolfSSL’s OpenSSL compatibility layer, addressing reports described in #12204 without changing callback behavior.
Changes:
- Introduces
WC_NO_SANITIZE_FUNCTIONwith compiler checks and an empty fallback. - Applies it to stack destructors, hash callbacks, and TXT_DB lookup callbacks.
- Annotates ASN.1 template callback callers and CTS128 encryption/decryption functions.
| File | Description |
|---|---|
wolfssl/wolfcrypt/types.h |
Defines the portable sanitizer-suppression macro. |
src/ssl_sk.c |
Annotates generic destructor and hash callback callers. |
src/ssl_crypto.c |
Annotates CTS128 CBC callback callers. |
src/ssl_asn1.c |
Annotates ASN.1 template callback helpers. |
src/conf.c |
Annotates TXT_DB indexed lookup callbacks. |
Review effort: Balanced
| return len; | ||
| } | ||
|
|
||
| WC_NO_SANITIZE_FUNCTION |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Clang's
-fsanitize=functionflags calls through function pointers whose type doesn't match the callee's. Typed free functions are called throughvoid (*)(void *). The types are not compatible in C, but the call is fine on supported ABIs.WC_NO_SANITIZE_FUNCTIONtowolfSSL_sk_pop_freeso clang skips the check.Addresses #12204