<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 21, 2016 at 5:04 AM, Jonas Wagner <span dir="ltr"><<a href="mailto:jonas.wagner@epfl.ch" target="_blank">jonas.wagner@epfl.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Your initial idea (compile with branches, then convert to nops) won't truly be zero-overhead because that still requires having the instrumentation present in the IR, which inhibits optimization. Actually, for UBSan I think this is the primary mechanism by which it "slows code down".</div></div></div></div></blockquote><div><br></div></span><div>This is very interesting! Do you know of any studies that measure this kind of effect?</div></div></div></blockquote><div><br></div><div>No (but I haven't looked).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Also, for sanitizers that use shadow, they really "want" instrumentation to be enabled "everywhere".</div></div></div></div></blockquote><div><br></div></span><div>There is some data on this, e.g, in <a href="http://dslab.epfl.ch/proj/asap/#publications" target="_blank">"High System-Code Security with Low Overhead"</a>. In this work we found that, for ASan as well as other instrumentation tools, most overhead comes from the checks. Especially for CPU-intensive applications, the cost of maintaining shadow memory is small.</div></div></div></blockquote><div><br></div><div>How did you measure this? If it was measured by removing the checks before optimization happens, then what you may have been measuring is not the execution overhead of the branches (which is what would be eliminated by nop'ing them out) but the effect on the optimizer.</div><div><br></div><div>-- Sean Silva</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>I'm happy to discuss this further. Also, if there are more suggestions on how to best implement this, let me know!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>- Jonas</div></font></span></div></div>
</blockquote></div><br></div></div>