Nick, Duncan, <div><br></div><div>Thank you for your replies. </div><div>I ended up using only right redzone for globals -- this seems to work. </div><div>It may miss left out-of-bound accesses (underruns) in rare cases, but I can live with that. </div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>--kcc </div><div><br><br><div class="gmail_quote">On Fri, Jun 17, 2011 at 10:42 PM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Kostya,<br>
<div class="im"><br>
> In order to find out-of-bound accesses to global objects with AddressSanitizer<br>
> (<a href="http://code.google.com/p/address-sanitizer/wiki/AddressSanitizer" target="_blank">http://code.google.com/p/address-sanitizer/wiki/AddressSanitizer</a>)<br>
> I need to create redzones to the left and to the right of every global variable.<br>
><br>
> I tried the following:<br>
> Before:<br>
>    @Extern = global [10 x i8] zeroinitializer, align 1<br>
> After:<br>
>    %0 = type { [32 x i8], [10 x i8], [54 x i8] }<br>
>    @Extern_asan_redzone = global %0 zeroinitializer, align 1<br>
>    @0 = global [10 x i8] zeroinitializer, align 1 << the old variable<br>
>    @Extern = alias getelementptr inbounds (%0* @Extern_asan_redzone, i32 0, i32 1)<br>
> I.e. I created a global struct @Extern_asan_redzone of 3 elements and an<br>
> alias @Extern that points to the middle element of this struct.<br>
<br>
</div>this is not currently possible.  You are not the first person to ask for this.<br>
If targets support it (I don't know if any do) then perhaps it can be added.<br>
<br>
Ciao, Duncan.<br>
<div><div></div><div class="h5">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div>