Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[analyzer][clang] Remove external plugin support #4112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gamesh411
Copy link
Collaborator

Shipping plugins as external dynamic libraries for Clang Static Analyzer is generally frowned upon, and not supported. This patch removes the existing support for using external ClangSA analyzer plugins.

Shipping plugins as external dynamic libraries for Clang Static Analyzer
is generally frowned upon, and not supported. This patch removes the
existing support for using external ClangSA analyzer plugins.
@whisperity whisperity added analyzer 📈 Related to the analyze commands (analysis driver) clang sa 🐉 The Clang Static Analyzer is a source code analysis tool that finds bugs in C-family programs. config ⚙️ labels Dec 7, 2023
@vodorok vodorok added this to the release 6.24.0 milestone Dec 8, 2023
@whisperity whisperity added the WARN ⚠️: Backward compatibility breaker! MIND THE GAP! Merging this patch will mess up compatibility with the previous releases! label Mar 21, 2024
Copy link
Member

@whisperity whisperity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, using the plugins is not supported. Moreover, if someone is enough of a power-user (one example I know of is https://github.com/GrammaTech/swap-detector) to use plugins, they can achieve the same by adding the flags explicitly to analyse --saargs or something.

@bruntib
Copy link
Contributor

bruntib commented Mar 21, 2024

I agree that the plugins could be provided by --saargs, so I approve this patch. But what do you mean by "not supported"? Clang 17 still has a -load flag for loading plugins.

@whisperity
Copy link
Member

But what do you mean by "not supported"? Clang 17 still has a -load flag for loading plugins.

There is also -fplugin=, which provides a higher-level interface.

It is not supported in the sense that you will get no help ("support") in using that feature, including help about crappy results, crashes, complete and utter corruption of your filesystem, exploits, etc. The official stance of CSA (but not necessarily Clang as a whole!), is that if you use plugins and anything goes wrong, you're — for the lack of a better phrase — SOL. (It's like reporting a kernel panic of a tainted kernel (a kernel that had proprietary kos (drivers) loaded into it), the number one reply you'll get on the mailing list is that your crash report is disregarded.) It is your own and absolute responsibility to deal with every consequence that stems from having a plugin.

And because it is unsupported, there are no guarantees that whatever code you create and potentially distribute as a plugin will work with any arbitrary Clang version. They don't care about API or ABI compatibility.

@whisperity whisperity self-requested a review March 25, 2024 13:16
whisperity

This comment was marked as duplicate.

Copy link
Member

@whisperity whisperity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gamesh411 I'll summarise what I discussed with @bruntib prior because it looks like they hadn't gotten around to publishing their comments so far.

@whisperity
Copy link
Member

Basically, there is one significant issue with this change where --saargs <file where -Xclang stuff is> is not equivalent to the plugin features, and that is the loading of the checker list. To the best of our understanding, while CodeChecker analyze does pass through the "saargs" parameter, the facilities for generating the checker list (and the engine options, likely, as well) do not**.

There is a question of what "support" means. I tried to find an official answer about the plugins, but to no avail. Technically, Clang offers the feature, but the --load flag is, AFAIK, not documented. Now we can decide we don't want to expose this through CodeChecker (power users who create plugins could just as well create downstream forks...), but maybe we should circle back to this after looking into what -fplugin= does, perhaps it's a documented (albeit not suggested, but nevertheless official) way of injecting customised checkers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📈 Related to the analyze commands (analysis driver) clang sa 🐉 The Clang Static Analyzer is a source code analysis tool that finds bugs in C-family programs. config ⚙️ WARN ⚠️: Backward compatibility breaker! MIND THE GAP! Merging this patch will mess up compatibility with the previous releases!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants