[analyzer] Failure to register checkers when multiple plugins are loaded

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[analyzer] Failure to register checkers when multiple plugins are loaded

Louis Dionne via cfe-dev
Hello clang-dev,

I'm (still) working at a configurable taint checker for a special use-case. It depends on the built-in `alpha.security.taint.TaintPropagation` checker doing most of the work.

As the built-in checker only models C constructs, we also have to model at least some C++ constructs in order for our analysis to be of reasonable use. An examle would be tainting return values of methods invoked on tainted objects. For the sake of reusability alone, I started writing an additional checker with the sole purpose of performing taint propagation in said situations.

However, it appears that when specifying multiple plugins via the `-load` parameter, `clang++` executes `clang_registerCheckers()` but not the initialization function passed to it (at least not for all plugins). Interestingly, both checkers are registered and invoked when the template-overload is used in one of them. The order of the `-load` parameters does not appear to matter, either. Sadly, it took nearly a day for me to figure this out.

I suppose this is a bug?

I'm using clang++ 5.0 right now. I did not test whether this reproduces with other versions of clang.

Greetings,
Julian Ganz
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [analyzer] Failure to register checkers when multiple plugins are loaded

Louis Dionne via cfe-dev
Hi Julian,

Loading multiple plugins should definitely be supported, could you give a bit more details on the error you get?
A smallest reproducible example (two checkers of a few lines each, a shell script compiling both and then loading them, and an example
of the behavior you expect but do not get) would be perfect.

Regards,
George

> On Apr 5, 2018, at 7:37 AM, Julian Ganz via cfe-dev <[hidden email]> wrote:
>
> Hello clang-dev,
>
> I'm (still) working at a configurable taint checker for a special use-case. It depends on the built-in `alpha.security.taint.TaintPropagation` checker doing most of the work.
>
> As the built-in checker only models C constructs, we also have to model at least some C++ constructs in order for our analysis to be of reasonable use. An examle would be tainting return values of methods invoked on tainted objects. For the sake of reusability alone, I started writing an additional checker with the sole purpose of performing taint propagation in said situations.
>
> However, it appears that when specifying multiple plugins via the `-load` parameter, `clang++` executes `clang_registerCheckers()` but not the initialization function passed to it (at least not for all plugins). Interestingly, both checkers are registered and invoked when the template-overload is used in one of them. The order of the `-load` parameters does not appear to matter, either. Sadly, it took nearly a day for me to figure this out.
>
> I suppose this is a bug?
>
> I'm using clang++ 5.0 right now. I did not test whether this reproduces with other versions of clang.
>
> Greetings,
> Julian Ganz
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [analyzer] Failure to register checkers when multiple plugins are loaded

Louis Dionne via cfe-dev
Hello George,
Hello List,

> Loading multiple plugins should definitely be supported, could you give a bit more details on the error you get?
Thanks for your reply. It turned out that the problem was me being stupid. I forgot to make the initialization function static, resulting in its symbol being exported. Since I used the same name in both modules, only one was called (twice, however) in the end.

Regards,
Julian Ganz
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev