Skip to contentSkip to conversation

Smatch v1.56 released

DISCUSSION Dan Carpenter 4 participants 5 messages Mar 4, 2012 – Mar 7, 2012

lore
Share & tools
lore
#0 lore raw

It's been almost two years since the last Smatch release so probably it's time for another one.

Smatch is a static analysis tool for C which has a lot of kernel specific checks.

To run Smatch over the entire kernel use:
smatch_scripts/test_kernel.sh

To run Smatch over just one .c file, start at the base of the kernel tree and use:
smatch_scripts/kchecker path/to/file.c

The main new thing, is the new cross function database work. You build a database on the first run and then use the information on the second run. The script for to build the database is:
smatch_scripts/build_kernel_data.sh

Smatch still produces a lot of false positives. Also as bugs get fixed in the kernel, the false positive to real bug ratio gets worse and worse. But it does find real bugs as well.

There is a mailing list [email protected].

regards,
dan carpenter

#1 lore raw
Quoted 3 lines · Dan Carpenter

Smatch still produces a lot of false positives. Also as bugs get fixed in the kernel, the false positive to real bug ratio gets worse and worse. But it does find real bugs as well.

Perhaps a database of known false positives and a mechanism to use it to see only new instances could be created.

#2 lore raw
Quoted 7 lines · Joe Perches
Quoted 3 lines · Dan Carpenter

Smatch still produces a lot of false positives. Also as bugs get fixed in the kernel, the false positive to real bug ratio gets worse and worse. But it does find real bugs as well.

Perhaps a database of known false positives and a mechanism to use it to see only new instances could be created.

Yes, this is actually what xgcc has been doing. See [1] to see how to do it more-or-less reliably.

[1] A system and language for building system-specific, static analyses, Hallem, S. and Chelf, B. and Xie, Y. and Engler, D.

regards,

Signature · 1 line
js
#3 lore raw
In reply to Joe Perches
Quoted 7 lines · Joe Perches
Quoted 3 lines · Dan Carpenter

Smatch still produces a lot of false positives. Also as bugs get fixed in the kernel, the false positive to real bug ratio gets worse and worse. But it does find real bugs as well.

Perhaps a database of known false positives and a mechanism to use it to see only new instances could be created.

What I do is only look at new bugs. I've got a script
smatch_scripts/new_bugs.sh
That takes the output from two smatch runs and prints the bugs which are new.

Artem has a set of scripts he's working on as well.

regards,
dan carpenter

#4 lore raw
Quoted 6 lines · Dan Carpenter

What I do is only look at new bugs. I've got a script
smatch_scripts/new_bugs.sh
That takes the output from two smatch runs and prints the bugs which are new.

Artem has a set of scripts he's working on as well.

Yeah, I basically compile with W=1, run sparse/coccinelle/cppcheck/smatch before and after a patch, compare the build logs and report about only new warnings. Quite useful when you are a maintainer.

Signature · 2 lines
Best Regards,
Artem Bityutskiy