www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - ASan: disabling instrumentation of specific function

reply Johan Engelen <j j.nl> writes:
Hi all,
   I just implemented blacklisting of functions for the 
sanitizers' instrumentation via a blacklist file (this is what 
Clang also provides): 
https://github.com/ldc-developers/ldc/pull/2261

But I think it is nice if we also provide a way to disable 
sanitizer instrumentation by adding a UDA to a function. For PGO, 
back then, I choose to enable/disable profiling instrumentation 
through a pragma. However, adding our own pragmas is quite 
invasive and touches frontend code, whereas adding a UDA is easy 
and nicely compartmentalized.

Any ideas for a name of the UDA? And where to put it, in 
ldc.attributes?
Clang has the no_sanitize_address attribute.

Thanks,
   Johan
Aug 03
parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Thursday, 3 August 2017 at 20:47:48 UTC, Johan Engelen wrote:
 Hi all,
   I just implemented blacklisting of functions for the 
 sanitizers' instrumentation via a blacklist file (this is what 
 Clang also provides): 
 https://github.com/ldc-developers/ldc/pull/2261

 But I think it is nice if we also provide a way to disable 
 sanitizer instrumentation by adding a UDA to a function. For 
 PGO, back then, I choose to enable/disable profiling 
 instrumentation through a pragma. However, adding our own 
 pragmas is quite invasive and touches frontend code, whereas 
 adding a UDA is easy and nicely compartmentalized.
Well, technically UDA's now touch fronted code, in the form of one entry in idgen.d. I haven't implemented any pragmas, but I'm sure they will be more complex.
 Any ideas for a name of the UDA? And where to put it, in 
 ldc.attributes?
 Clang has the no_sanitize_address attribute.
Will blacklisting other sanitisers happen at a future point? if so it may make sense to do // Probably already exists, but w/e // force the type enum Sanitizer : byte { Address, Thread, // Other sanitisers } struct blacklist // or struct noSanitize { Sanitizer s; } otherwise just private struct _noSanitizeAddress {}; enum noSanitizeAddress = _noSanitizeAddress();
 Thanks,
   Johan
Aug 08
parent Jacob Carlborg <doob me.com> writes:
On 2017-08-09 03:56, Nicholas Wilson wrote:

 Well, technically UDA's now touch fronted code, in the form of one entry
 in idgen.d.
idgen is basically a cache, nothing is _required_ to be in the cache. It also helps avoid misspelling symbol names known by the compiler. -- /Jacob Carlborg
Aug 09