<div dir="ltr">Hi,<div><br></div><div class="gmail_quote"><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><div>This is very interesting! Do you know of any studies that measure this kind of effect?</div><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><div>There is some data on this, e.g, in <a href="http://dslab.epfl.ch/proj/asap/#publications">"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><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><div><br></div><div>- Jonas</div></div></div>