-
Notifications
You must be signed in to change notification settings - Fork 38
Fix false positives in constant time tests using MSan with Clang 16 #170
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
base: development
Are you sure you want to change the base?
Fix false positives in constant time tests using MSan with Clang 16 #170
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Now that #135 is merged, this is incomplete: there is now a test component to update in crypto as well as mbedtls. So I've rebased on top of |
f329ffa
to
f9d9493
Compare
I'm rebasing again because the CI was failing on |
In the documentation of `MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN`, note that since Clang 16, an extra command line option `-fsanitize-memory-param-retval` is required. As documented in the release notes https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html#sanitizers since Clang 16, MSan forbids passing "uninitialized" values in and out of functions. In constant-flow testing, "uninitialized" values are actually secrets that must be manipulated with a data-independent flow, and it's perfectly fine to pass these in and out of functions. Fix #9921 Signed-off-by: Gilles Peskine <[email protected]>
New CMake build types CFMemSan, CFMemSanDbg to take care of differing compiler command lines with Clang <15 and Clang >=16. Signed-off-by: Gilles Peskine <[email protected]>
Add some basic checks of constant flow sanitizers. In particular, detect the specific way in which Clang 16 broke our constant-flow testing (by default, "uninitialized" values may not be passed to or returned from functions). Signed-off-by: Gilles Peskine <[email protected]>
Support Clang >=16 in component_test_memsan_constant_flow_psa. Modern versions of Clang require an extra compiler option to avoid false positives. Fixes #9921. Signed-off-by: Gilles Peskine <[email protected]>
f9d9493
to
e5d9535
Compare
Fix false positives of constant-flow testing when using
MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN
on Clang 16 and above. Fixes Mbed-TLS/mbedtls#9921.This isn't needed for the CI (in the short to medium term) because still we do this testing on an old platform with an old Clang, but is needed on typical developer machines nowadays.
PR checklist