Open
Bug 1503647
Opened 7 years ago
Updated 3 years ago
Add support for building out of tree checkers in the clang plugin
Categories
(Developer Infrastructure :: Source Code Analysis, enhancement, P3)
Developer Infrastructure
Source Code Analysis
Tracking
(Not tracked)
NEW
People
(Reporter: ehsan.akhgari, Unassigned)
Details
It would be nice to be able to run some private checkers in our clang plugin which we don't publish the source code to, for security sensitive static analyses.
This basically amounts to adding a new build-time configuration flag like --with-clang-plugin-checks=/path/to/dir, which, once enabled, would add hooks inside the following places:
* Add something to build/clang-plugin/moz.build to pick up /path/to/dir/moz.build.
* Add something to build/clang-plugin/ChecksIncludes.inc to pick up /path/to/dir/ChecksIncludes.inc.
* Add something to build/clang-plugin/Checks.inc to to pick up /path/to/dir/Checks.inc.
This would allow us to upload a new static checker in source form to tooltool and build it in infra when building clang-tidy.
| Reporter | ||
Comment 1•7 years ago
|
||
Actually, perhaps instead of the last step in comment 0, we should keep Checks.inc separate from the out of tree copy, and include the out of tree copy separately so that here <https://searchfox.org/mozilla-central/source/build/clang-plugin/MozillaTidyModule.cpp#20> we can give those checks a different prefix (e.g., mozilla-external-foo).
Comment 2•7 years ago
|
||
Why not just store your code in a patch form and apply that patch when building clang-tidy?
| Reporter | ||
Comment 3•7 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #2)
> Why not just store your code in a patch form and apply that patch when
> building clang-tidy?
Because it would keep breaking as the underlying code changes. Maintaining stuff that lives in tooltool is difficult since it wouldn't be obvious to update them as the in-tree code changes.
Comment 4•7 years ago
|
||
The only files where there could be conflicts are those you listed in comment 0, and if you add placeholder comments, patches that add stuff between the placeholders should apply to them with fuzzing without any problem. Even if there are problems, that woouldn't go unnoticed, since it would break the clang-tidy jobs.
| Reporter | ||
Comment 5•7 years ago
|
||
It's true, placeholder comments would make things better indeed. Not 100% ideal but better.
Thinking more about this, if we could just have separate files that we wouldn't normally edit, that would really solve the problem. We could keep those files mostly empty and only use them for applying the out-of-tree diffs. Doing that for Checks.inc and ChecksIncludes.inc is trivial since those two are just headers that we #include, but what about moz.build? Do we have a facility for including one moz.build file inside the same directory into another?
Comment 6•7 years ago
|
||
include()
| Reporter | ||
Comment 7•7 years ago
|
||
Great, thanks! Then I think that would be a much simpler solution.
Anyone working on this? I assume not so I was planning on picking this up this quarter, and trialing it with 1114683 and 1279569. Any objections/considerations, let me know, otherwise I'll go ahead.
Comment 9•6 years ago
|
||
Please go ahead! Don't hesitate to get in touch with Andi and Ehsan to gather input.
Updated•6 years ago
|
Severity: normal → enhancement
Priority: -- → P3
Updated•6 years ago
|
Assignee: nobody → ptheriault
I didn't make a lot of progress on this bug, so I'm removing myself from this for now. I (think I) managed to un-bitrot the clang-plugin for bug 1114683, but I hit a lot of challenges here, not least of which was my limited experience with writing/building c++. I had a lot more success with Semmle/LGTM, so I'm going to pursue that for now since we already have a private instance setup.
Assignee: ptheriault → nobody
Updated•3 years ago
|
Product: Firefox Build System → Developer Infrastructure
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•