[all-commits] [llvm/llvm-project] 89c4b2: [GuardWidening] Fix a nasty cast bug in c2eccc6
Philip Reames via All-commits
all-commits at lists.llvm.org
Tue Jun 7 13:31:40 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 89c4b29e8d35ec352019d828e546bea3850403df
https://github.com/llvm/llvm-project/commit/89c4b29e8d35ec352019d828e546bea3850403df
Author: Philip Reames <preames at rivosinc.com>
Date: 2022-06-07 (Tue, 07 Jun 2022)
Changed paths:
M llvm/lib/Transforms/Scalar/GuardWidening.cpp
Log Message:
-----------
[GuardWidening] Fix a nasty cast bug in c2eccc6
c2eccc6 introduced a call to etHasNoUnsignedWrap which implicitly assumes that Inst is a OverflowingBinaryOperator. This is frequently untrue, but was not caught because cast<Ty>(X) has been broken, see https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.
I considered reverting this, but since doing so re-introduces a nasty miscompile of its own, I decided to fix forward instead.
I'll note that this is a particularly nasty form of the cast<Ty>(X) issue. Because the cast was succeeding unexpected, we were writing data to instructions which weren't OBOs. This could result in near arbitrary data or memory corruption. I'm a bit shocked that the sanitizers didn't find this TBH.
More information about the All-commits
mailing list