<div dir="ltr">+Maxim and Yuri, as I think this is their code. </div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 12, 2015 at 3:02 AM, Jay Foad <span dir="ltr"><<a href="mailto:jay.foad@gmail.com" target="_blank">jay.foad@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(Resending with the correct mailing list address.)<br>
<div class="HOEnZb"><div class="h5"><br>
Hi,<br>
<br>
Currently test/asan/TestCases/alloca_vla_interact.cc is XFAILed for<br>
powerpc64. I've had a look at why it doesn't work. I think the only<br>
problem is in the call to __asan_allocas_unpoison that is inserted at<br>
the end of the "for" loop (just before a stackrestore instruction).<br>
<br>
The call function is created something like this (paraphrasing from<br>
lib/Transfoms/Instrumentation/AddressSanitizer.cpp):<br>
<br>
  // call __asan_allocas_unpoison(uptr top, uptr bottom);<br>
  // NB "top" here means lowest address and "bottom" means highest!<br>
<br>
  IRB.CreateCall(<br>
    AsanAllocasUnpoisonFunc,<br>
    {<br>
      IRB.CreateLoad(DynamicAllocaLayout),<br>
      IRB.CreatePointerToInt(SaveRestoreInst->getOperand(0), IntptrTy)<br>
    }<br>
  );<br>
<br>
I think the problem is that the operand to stackrestore is the new<br>
native sp register value to restore, and this code is assuming that<br>
that will be a higher address than all the allocas that are being<br>
unallocated. But on PowerPC64, the native sp is always lower than the<br>
address of the most recent alloca by MaxCallFrameSize bytes, to leave<br>
space for outgoing call arguments. So I think the second argument to<br>
__asan_allocas_unpoison needs to be SaveRestoreInst->getOperand(0) +<br>
MaxCallFrameSize, but I don't know how to implement that.<br>
<br>
Thoughts?<br>
<br>
Thanks,<br>
Jay.<br>
</div></div></blockquote></div><br></div>