mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

Fix problems found by clang+UBSan on Ubuntu 20.04

Open gilles-peskine-arm opened this issue 2 years ago • 7 comments

Fix some issues reported by UBSan with a recent Clang (but not by a recent GCC or an old Clang). They are genuine instances of undefined behavior, although in practice compilers and processors are very likely to do what we want. This includes an issue fixed in https://github.com/Mbed-TLS/mbedtls/pull/6609. Now tests will pass when building with Clang and UBSan on Ubuntu 20.04.

Run UBSan with a recent Clang on the CI. I replaced a GCC+UBSan component, so the CI load will remain the same. Fixes #6610.

Gatekeeper checklist

  • [x] changelog no (test only)
  • [ ] backport TODO
  • [x] tests N/A (it's all test)

gilles-peskine-arm avatar Nov 16 '22 13:11 gilles-peskine-arm

Hmm, CI failing with

Component test_full_cmake_clang_asan was explicitly requested, but is not known or not supported.

tom-cosgrove-arm avatar Nov 16 '22 16:11 tom-cosgrove-arm

Regarding the preceding-pr #6609, is this one instead of that older one, or does 6609 need reviewing in additon?

tom-cosgrove-arm avatar Nov 17 '22 09:11 tom-cosgrove-arm

This PR has all the commits of #6609 (so far) plus more stuff. I'd prefer to get #6609 (and trivial backport) in first, then rebase this one (and backport which might be nontrivial depending on exactly how all.sh evolves and what this means with SSL testing).

gilles-peskine-arm avatar Nov 17 '22 09:11 gilles-peskine-arm

@daverodgman @tom-cosgrove-arm The UB fix part, plus a reduced Travis test, is up for review at https://github.com/Mbed-TLS/mbedtls/pull/6648

gilles-peskine-arm avatar Nov 23 '22 17:11 gilles-peskine-arm

What's happening with this PR now?

tom-cosgrove-arm avatar Nov 24 '22 11:11 tom-cosgrove-arm

@tom-cosgrove-arm

  1. Get the UB fix and minimum-effort Travis test in (https://github.com/Mbed-TLS/mbedtls/pull/6648 and I'm still working on the minimum-effort Travis test for 2.28, hope to get that passing today).
  2. Merge https://github.com/Mbed-TLS/mbedtls-test/pull/76
  3. Rebase this PR to be just the all.sh changes (which are passing! But not running until the Groovy code is fixed)

gilles-peskine-arm avatar Nov 24 '22 12:11 gilles-peskine-arm

As part of our review of historical PRs we have made the decision to convert older PRs that have not been updated in 3 months into drafts until they are worked on again.

tom-daubney-arm avatar May 18 '23 18:05 tom-daubney-arm