-
Notifications
You must be signed in to change notification settings - Fork 13.5k
UBSAN failures in clang constant interpreter tests on 32 bit ARM #94741
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
Comments
To reproduce by cross compiling on Linux: Download toolchain from: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads Extract and add it to your PATH:
Set up a symlink inside the toolchain so it can find
Then configure llvm using this script:
Now install
Interestingly, these values are different from what we see on armv8 hardware, which makes sense if there is UB here.
To reproduce the other failed tests, add I will continue to look for a solution on native hardware. |
Currently suspect this code:
|
Hey I just wanna point out |
Thank you, I had confused the two. Which means the issue caused by #89811 is in clang-repl and the ones I'm seeing here are in the constant interpreter. |
For those who have access to hardware, I could use the rest of the cross compilation guide for running on Raspberry Pi 4, Debian 12. I have used GCC 12.2 for glibc compatibility, instead of GCC 13.2
GCC 12.2 available here: https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz?rev=9929cb6c0e8948f0ba1a621167fcd56d&hash=8F13B510F8B20149258CB4AA5372BF92 |
@llvm/issue-subscribers-clang-frontend Author: David Spickett (DavidSpickett)
Doing a 32 bit Arm build with UBSAN enabled, I get many failures from the clang interpreter:
```
Clang :: AST/Interp/arrays.cpp
Clang :: AST/Interp/atomic.c
Clang :: AST/Interp/atomic.cpp
Clang :: AST/Interp/bitfields.cpp
Clang :: AST/Interp/builtin-align-cxx.cpp
Clang :: AST/Interp/builtin-functions.cpp
Clang :: AST/Interp/builtins.cpp
Clang :: AST/Interp/c.c
Clang :: AST/Interp/c23.c
Clang :: AST/Interp/comma.cpp
Clang :: AST/Interp/complex.c
Clang :: AST/Interp/complex.cpp
Clang :: AST/Interp/cond.cpp
Clang :: AST/Interp/const-eval.c
Clang :: AST/Interp/const-fpfeatures.cpp
Clang :: AST/Interp/constexpr-nqueens.cpp
Clang :: AST/Interp/constexpr-subobj-initialization.cpp
Clang :: AST/Interp/cxx03.cpp
Clang :: AST/Interp/cxx11.cpp
Clang :: AST/Interp/cxx17.cpp
Clang :: AST/Interp/cxx20.cpp
Clang :: AST/Interp/cxx23.cpp
Clang :: AST/Interp/cxx98.cpp
Clang :: AST/Interp/depth-limit.cpp
Clang :: AST/Interp/enums-targets.cpp
Clang :: AST/Interp/enums.cpp
Clang :: AST/Interp/eval-order.cpp
Clang :: AST/Interp/floats.cpp
Clang :: AST/Interp/functions.cpp
Clang :: AST/Interp/if.cpp
Clang :: AST/Interp/intap.cpp
Clang :: AST/Interp/invalid.cpp
Clang :: AST/Interp/lambda.cpp
Clang :: AST/Interp/lifetimes.cpp
Clang :: AST/Interp/literals.cpp
Clang :: AST/Interp/loops.cpp
Clang :: AST/Interp/memberpointers.cpp
Clang :: AST/Interp/nullable.cpp
Clang :: AST/Interp/objc.mm
Clang :: AST/Interp/opencl.cl
Clang :: AST/Interp/pointer-addition.c
Clang :: AST/Interp/records.cpp
Clang :: AST/Interp/references.cpp
Clang :: AST/Interp/shifts.cpp
Clang :: AST/Interp/spaceship.cpp
Clang :: AST/Interp/switch.cpp
Clang :: AST/Interp/sycl.cpp
Clang :: AST/Interp/unions.cpp
Clang :: AST/Interp/vectors.cpp
Clang :: AST/Interp/weak.cpp
```
Most of them are problems with reference binding or calling of constructors on misaligned addresses. Usually the type requires 8 byte alignment but the address is 4 byte aligned.
I think the assumptions in the interpreter's management of its virtual stack do not hold for 32 bit Arm. I don't know that that's the cause of all the issues we have seen without UBSAN, but it seems likely. |
Doing a 32 bit Arm build with UBSAN enabled, I get many failures from the clang interpreter:
Most of them are problems with reference binding or calling of constructors on misaligned addresses. Usually the type requires 8 byte alignment but the address is 4 byte aligned.
This has come up a lot recently, including #89811 which has "uncovered" this issue outside of UBSAN builds.I think the assumptions in the interpreter's management of its virtual stack do not hold for 32 bit Arm. I don't know that that's the cause of all the issues we have seen without UBSAN, but it seems likely.
The text was updated successfully, but these errors were encountered: