<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 9/30/13 9:40 AM, Alexey Samsonov
wrote:<br>
</div>
<blockquote
cite="mid:CAGSYnCObHGr-9kDxLLmBmfX13SivH1-uySBkfF_i=ntgS5wthw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="ltr">Hi llvmdev!
<div><br>
</div>
<div>There are cases when we want our instrumentation passes for
Sanitizer tools to insert llvm.memset.* calls (basically, we
want to mark certain region of user memory as (un)addressable
by writing magic values for "shadow" of that memory region).
llvm.memset are convenient:</div>
<div>(1) we don't have to manually emit all these n-byte stores
in a cycle.</div>
<div>(2) llvm.memset can be inlined as a platform-specific fast
instructions (e.g. SSE).</div>
<div>But there will be a problem if llvm.memset is lowered into
a regular memset() call: sanitizer runtime libraries intercept
all memset() calls and treat them as function calls made by
user, in particular checking that its arguments point to an
addressable "user" memory, not some sanitizer-specific memory
regions.</div>
<div><br>
</div>
<div>Can you suggest a way to ensure llvm.memset() is not
transformed into memset function()? This intrinsic has
<isvolatile> argument, which limits possible
optimization of this call, does it make sense to add yet
another argument, that would forbid transforming it into
function calls?</div>
</div>
</blockquote>
<br>
Dumb question: why not run the ASan instrumentation passes first and
then run the pass that inserts the calls to llvm.memset()?<br>
<br>
Alternatively, why not put the llvm.memset and load/store
instrumentation into a single pass? That way, the pass can
determine which memsets it added itself and which are ones from the
original program that need instrumentation.<br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:CAGSYnCObHGr-9kDxLLmBmfX13SivH1-uySBkfF_i=ntgS5wthw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div><br>
</div>
-- <br>
<div>Alexey Samsonov, MSK</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>