[llvm-dev] Adding support for self-modifying branches to LLVM?

Sean Silva via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 21 13:45:26 PST 2016


On Thu, Jan 21, 2016 at 5:04 AM, Jonas Wagner <jonas.wagner at epfl.ch> wrote:

> Hi,
>
> 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".
>>
>
> This is very interesting! Do you know of any studies that measure this
> kind of effect?
>

No (but I haven't looked).


>
> Also, for sanitizers that use shadow, they really "want" instrumentation
>> to be enabled "everywhere".
>>
>
> There is some data on this, e.g, in "High System-Code Security with Low
> Overhead" <http://dslab.epfl.ch/proj/asap/#publications>. 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.
>

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.

-- Sean Silva



>
> I'm happy to discuss this further. Also, if there are more suggestions on
> how to best implement this, let me know!
>
> - Jonas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160121/05496d95/attachment.html>


More information about the llvm-dev mailing list