[llvm] [CodeGen][WinEH] Update saved esp for inlined inallocas (PR #116585)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 03:57:29 PST 2024


================
@@ -774,3 +778,27 @@ void WinEHStatePass::insertStateNumberStore(Instruction *IP, int State) {
                                               RegNode, StateFieldIndex);
   Builder.CreateStore(Builder.getInt32(State), StateField);
 }
+
+void WinEHStatePass::updateEspForInAllocas(Function &F) {
+  for (BasicBlock &BB : F) {
+    for (Instruction &I : BB) {
+      if (auto *Alloca = dyn_cast<AllocaInst>(&I)) {
+        if (!Alloca->isUsedWithInAlloca())
----------------
MuellerMP wrote:

I wonder if there is any security aspect to this since the original bug was causing a stack object overrun, which could theoretically be used for exploitation in some weird scenario.
But since this is only caused by a miscompile of clang-cl I'm uncertain wheter this is actually relevant.

https://github.com/llvm/llvm-project/pull/116585


More information about the llvm-commits mailing list