You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When shufflevector's mask is undef, AArch64 will have out of bound read on the latest commit cfd2c5ce
You can check it out here: https://llvm.godbolt.org/z/9xEPWa76c
On LLVM14, it reports as Invalid shufflevector operands! and treated undef as a uninitialized vector.
It seems problem starts at AArch64ISelLowering.cpp:13391 where the Mask(undef) is taken and used without any sanity check.
Below is a sample input and corresponding stack trace.
I tried to fix it with a simple check, submitted a patch here, but failed the check in other places. @fhahn Would you mind help me out with this? Sorry I am not super familiar with AArch64 backend.
…VectorInst's mask
This commit fixesllvm/llvm-project#57326.
Currently we would take a Mask out and directly use it by doing
auto Mask = SVI->getShuffleMask();
However, if the mask is undef, this Mask is not initialized. It might be
a vector of -1 or random integers.
This would cause an Out-of-bound read later when trying to find a
StartMask.
This change checks if all indices in the Mask is in the allowed range,
and fixes the out-of-bound accesses.
Differential Revision: https://reviews.llvm.org/D132634
When
shufflevector
's mask is undef, AArch64 will have out of bound read on the latest commitcfd2c5ce
You can check it out here: https://llvm.godbolt.org/z/9xEPWa76c
On LLVM14, it reports as
Invalid shufflevector operands!
and treatedundef
as a uninitialized vector.It seems problem starts at
AArch64ISelLowering.cpp:13391
where the Mask(undef) is taken and used without any sanity check.Below is a sample input and corresponding stack trace.
The text was updated successfully, but these errors were encountered: