[PATCH] D18690: [LSAN] Fix test swapcontext.cc on MIPS

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 15 09:22:30 PDT 2016


kcc added a comment.

In http://reviews.llvm.org/D18690#402241, @sagar wrote:

> > Is a test (that works on Linux x86_64) possible here?
>
>
> The test swapcontext.cc itself serves as a test for invalid frame on Linux x86_64 too. The difference between x86_64 and mips in case of unwinding is that x86 uses fast unwinder which checks if the frame is valid before unwinding and mips uses slow unwinder which does not check if the frame is valid before unwinding.


I am not sure I understand this. 
If the existing test is enough for Linux x86_64 then why we would need this patch? 
I want a test that will fail with the current code and get fixed with your patch (on Linux x86_64). Is such test possible?


================
Comment at: lib/lsan/lsan.h:23
@@ -22,3 +22,3 @@
     ThreadContext *t;                                                          \
-    if (fast && (t = CurrentThreadContext())) {                                \
       stack_top = t->stack_end();                                              \
----------------
sagar wrote:
> kcc wrote:
> > Why did you remove this check  (fast &&)?
> Before this patch frame validity check was there only for fast unwinder. So stack top and bottom were fetched only in case of fast unwinder as per my understanding. Now we need it for both unwinders irrespective of whether we use the fast or slow unwinder. Thats the reason I removed this check. Is there any other significance to this check?
I don't know. 
This code is extremely fragile and extremely hard to test, 
so any changes in this code are scary, unless you can properly explain them and test them.


Repository:
  rL LLVM

http://reviews.llvm.org/D18690





More information about the llvm-commits mailing list