Hi David,

> Building GCC from source and stepping through it in the
> debugger would be good next steps.  You'll need plenty of disk space.
>  "run_checkers" is a good breakpoint to set if you're looking for the
> entrypoint to the analyzer.
>

I tried this and I understood the control flow in the analyzer.

> There's an example plugin in that patch.  The kernel source tree
> already has some plugins, so hopefully, those together give some
> pointers on how to write a "hello world" analyzer plugin that runs as
> part of the kernel build, which would be another next step, I guess.
>

I implemented a very simple hello world plugin here -
https://github.com/adharshkamath/Hello-world-plugin.
<https://github.com/adharshkamath/Hello-world-plugin>
It just prints a Hello message while building the Linux Kernel, if the
-fanalyzer option is enabled. I referred to the example plugin in the
static analyzer
and the plugins in the kernel source to do this.

> See::
>   * "How to write system-specific, static checkers in Metal" (Benjamin
> Chelf, Dawson R Engler, Seth Hallem), from 2002
>   * "Checking system rules using system-specific, programmer-written
> compiler extensions" Proceedings of Operating Systems Design and
> Implementation (OSDI), September 2000. D. Engler, B. Chelf, A. Chou,
> and S. Hallem.
>   * "Using Programmer-Written Compiler Extensions to Catch Security
> Holes" (Ken Ashcraft, Dawson Engler) from 2002
>

These were useful and interesting to read. Thank you for suggesting them.
Adharsh

Reply via email to