[llvm-commits] [PATCH] [asan] Always use file+offset in symbolizer

Alexey Samsonov samsonov at google.com
Thu Oct 18 02:48:02 PDT 2012


On Thu, Oct 18, 2012 at 1:32 PM, NAKAMURA Takumi <geek4civic at gmail.com>wrote:

>
>   > Besides, I still want the offsets to be meaningful for addr2line/atos.
>
>     #0 0x804a7e6
> (projects/compiler-rt/lib/asan/lit_tests/Output/use-after-free.cc.tmp+0x27e6)
>
>   Then should the address (0x804a7e6) be taken by them instead of the
> offset (0x27e6)?
>

I probably miss something here. As I understand, your non-PIE binary code
segment
is loaded at 0x8048000, right? What do you see when you run "objdump -d" on
this binary?
Does the instruction addresses have the form 0x804.... as well? If they do,
we want the
first line to have the form
#0 0x804a7e6
(projects/compiler-rt/lib/asan/lit_tests/Output/use-after-free.cc.tmp+0x804a7e6)
as well, for compatibility with addr2line, objdump etc.


>   Anyways, I don't know how to distinguish PIE in runtime, though.
>

Yeah, neither do I (for now). Now to check if the module is main non-PIE
binary we check if
the module is first in the list of mappings. We can instead invent more
loose (but still hacky)
condition - the module address should be "small" (say, in the lower half of
address space), and
its name shouldn't have a dynamic library suffix.


> ================
> Comment at: compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h:56
> @@ -67,1 +55,3 @@
> +       // FIXME: file_offset doesn't make sense if it is not zero.
> +        *offset = (addr - start) + file_offset;
>          return true;
> ----------------
> I guess it is used on both darwin and linux (and possibly android?)
>
> Could we rewrite here conditioned out with; ?
> #if defined(__linux__)
> *offset = (addr - start) + file_offset;
> #else
> *offset = (addr - (i ? start : 0)) + file_offset;
> #endif
>
> As long as the emission would be handled by Addr2LineSymbolizer.



>
>
> http://llvm-reviews.chandlerc.com/D66
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>

-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121018/1169343b/attachment.html>


More information about the llvm-commits mailing list