<div dir="ltr">Thanks! I'll try that.<div><br></div><div>In order to avoid starting a new thread, let me ask you the next question. One of the shared libraries I load calls strtol and msan fails to intercept it. Why would this be? The library seems to be otherwise implemented. One of the potential culprits I saw is that strtol is marked as strong in libc. Is there any workaround?</div><div><br></div><div>Keno</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 9, 2015 at 3:00 PM, Evgeniy Stepanov <span dir="ltr"><<a href="mailto:eugeni.stepanov@gmail.com" target="_blank">eugeni.stepanov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Apr 9, 2015 at 9:24 PM, Keno Fischer<br>
<<a href="mailto:kfischer@college.harvard.edu">kfischer@college.harvard.edu</a>> wrote:<br>
> Hi everyone,<br>
><br>
> I ran into a false positive with memory sanitizer due to it not intercepting<br>
> dlinfo. I tried to get started on writing such an interceptor, but dlinfo<br>
> seems like an extraordinarily difficult function to intercept. The three<br>
> considerations that I would like somebody to look at are:<br>
><br>
> 1) How do we get the enum values to decide what kind of pointer dlinfo is<br>
> getting. Ideally we'd include dlfcn.h, but the interceptor file doesn't<br>
> generally include system headers. What's the right thing to do here?<br>
<br>
</span>We generally redefine system constants and types in<br>
sanitizer_platform_limits_posix.h and verify correctness with<br>
assertions in .cc.<br>
<span class=""><br>
> 2) The structures pointed to contain linked lists, etc. of dynamic linker<br>
> state. In order to avoid spurious failures, it seems like we should iterate<br>
> the linked lists and unpoison all of them, but that seems expensive. Do you<br>
> see a better solution?<br>
<br>
</span>Nope, sounds like that's want you need to do.<br>
<span class=""><br>
> 3) The return values include pointers into the object files. It seems<br>
> perfectly reasonable for a user to want to read these object files based on<br>
> information from dlinfo. That probably means we should unpoison them as<br>
> well? Do we need to do something here or are these already unpoisoned by<br>
> some other mechanism (e.g. because msan realizes they are part of a loaded<br>
> object file or unposions them on load - does this happen?).<br>
<br>
</span>They are unpoisoned. All memory defaults to unpoisoned (shadow == 0),<br>
and we take care of unpoisoning all memory we return to the OS.<br>
<br>
><br>
> Thanks,<br>
> Keno<br>
><br>
><br>
</blockquote></div><br></div>