[PATCH] D118647: [hwasan] work around lifetime issue with setjmp.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 13:53:33 PST 2022


eugenis added subscribers: pcc, eugenis.
eugenis added a comment.

This is a great find. @pcc 
It seems like it would affect AArch64StackTagging, and some of the sanitizers as well (ASan in particular).
Also I don't see anything in CodeGen/StackColoring.cpp to avoid this case - is it possible for it to cause erroneous stack slot reuse?



================
Comment at: llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope-setjmp.ll:26
+  store i8* %0, i8** @stackbuf, align 8
+  call void @may_jump() #7
+  call void @llvm.lifetime.end.p0i8(i64 4096, i8* nonnull %0) #10
----------------
so the callee of this may longjmp, bypassing the lifetime.end. Effectively, this adds a DT edge from any call site in this function to immediately after  the setjmp call.

Please add some comments here explaining this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118647/new/

https://reviews.llvm.org/D118647



More information about the llvm-commits mailing list