-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UBSAN triggers on is_available
getting passed an incorrect function type
#4438
Comments
Found more
|
Thanks for this issue, we'll take a look. |
Hi @justhecuke! What platform did you use to produce these warnings? I have ubsan running on Clang 15 with ARM, seem to get a different set of warning than the ones you encountered. |
Hey, I'm not sure how to answer "what platform", but it's Clang 17 in Bazel. We have a bit of a frankenstein system and I'm building this as part of our own build, which is where I find the sanitizer issues. The code I'm working with is from a EDIT: I think it's |
In any case, even if I'm wrong on the specifics, it's somewhat clear that UBSAN can help in CI or some manual runs every now and then. |
Problem:
UBSAN is triggering on misuse of
is_available
withs2n_stream_cipher_rc4_available
froms2n-tls/crypto/s2n_stream_cipher_rc4.c
Line 33 in a56e9bf
s2n_cipher_suites.c:985:17: runtime error: call to function s2n_stream_cipher_rc4_available through pointer to incorrect function type 'unsigned char (*)(void)'
In this case, we're passing a
uint8_t s2n_stream_cipher_rc4_available()
tois_available
which wants auint8_t (*is_available)(void)
To Reproduce:
I don't have an explicit copy-pasteable example, but it should be easy to reproduce if you have UBSAN set up. Simply create a program that calls
s2n_rc4.is_available()
and compile (-fsanitize=undefined -fno-sanitize-recover=undefined
) + run it with UBSAN . It should show you the issue.Solution:
Either fix the signature of
s2n_stream_cipher_rc4_available
to return a pointer, or fix #3983Probably not, but I lack the knowledge to say for sure.
I think so, but I'm not certain.
N/A
Requirements / Acceptance Criteria:
Get the signatures of
s2n_stream_cipher_rc4_available
andis_available
to match so that UBSAN stops complaining.#3983
Get UBSAN running in CI/testing. This is a pretty trivial issue for it to detect and it makes me think there's other issues lurking around in the code.
Unknown
No. N/A
Out of scope:
Is there anything the solution will intentionally NOT address?
The text was updated successfully, but these errors were encountered: