-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[Arm] Fix UAF in ARMConstantIslandPass #146232
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
[Arm] Fix UAF in ARMConstantIslandPass #146232
Conversation
Created using spr 1.3.6
@llvm/pr-subscribers-backend-arm Author: Qinkun Bao (qinkunbao) Changes#146198 changes
to
Unfortunately, they are not NFC and causes the buildbot error. e.g., Full diff: https://github.com/llvm/llvm-project/pull/146232.diff 1 Files Affected:
diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
index e72aa8ef051cd..ca3dc15ff3ad6 100644
--- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -476,8 +476,8 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &mf) {
LLVM_DEBUG(dbgs() << "Beginning BR iteration #" << NoBRIters << '\n');
bool BRChange = false;
- for (ImmBranch &Br : ImmBranches)
- BRChange |= fixupImmediateBr(Br);
+ for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i)
+ BRChange |= fixupImmediateBr(ImmBranches[i]);
if (BRChange && ++NoBRIters > 30)
report_fatal_error("Branch Fix Up pass failed to converge!");
LLVM_DEBUG(dumpBBs());
|
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. Thanks!
I'm assuming this is fixupImmediateBr resizing the vector, can you use make_early_inc_range |
Created using spr 1.3.6
Looks like it does not work. |
llvm#146198 changes ``` for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i) BRChange |= fixupImmediateBr(ImmBranches[i]); ``` to ``` for (ImmBranch &Br : ImmBranches) BRChange |= fixupImmediateBr(Br); ``` Unfortunately, they are not NFC and cause the buildbot error. e.g., https://lab.llvm.org/buildbot/#/builders/24/builds/9943 https://lab.llvm.org/buildbot/#/builders/169/builds/12570 Use make_early_inc_range to fix the issue
llvm#146198 changes ``` for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i) BRChange |= fixupImmediateBr(ImmBranches[i]); ``` to ``` for (ImmBranch &Br : ImmBranches) BRChange |= fixupImmediateBr(Br); ``` Unfortunately, they are not NFC and cause the buildbot error. e.g., https://lab.llvm.org/buildbot/#/builders/24/builds/9943 https://lab.llvm.org/buildbot/#/builders/169/builds/12570 Use make_early_inc_range to fix the issue
#146198 changes
to
Unfortunately, they are not NFC and cause the buildbot error. e.g.,
https://lab.llvm.org/buildbot/#/builders/24/builds/9943
https://lab.llvm.org/buildbot/#/builders/169/builds/12570
Use make_early_inc_range to fix the issue