1 Samsung Open Source Group
Stefan Schmidt Samsung Open Source Group stefan@osg.samsung.com
Static Analysis of Your OSS Project with Coverity LinuxCon EU 2015 - - PowerPoint PPT Presentation
Static Analysis of Your OSS Project with Coverity LinuxCon EU 2015 Stefan Schmidt Samsung Open Source Group stefan@osg.samsung.com Samsung Open Source Group 1 Agenda Introduction Survey of Available Analysers Coverity Scan
1 Samsung Open Source Group
Stefan Schmidt Samsung Open Source Group stefan@osg.samsung.com
2 Samsung Open Source Group
3 Samsung Open Source Group
4 Samsung Open Source Group
– Analysis of the soure code without execution – Usage of algorithms and techniques to find bugs in source code
– A formal verification of your code – A proof that your code is bug free
– Allows to find many types of defects early in the development process – Resource leaks, NULL pointer dereferences, memory corruptions, buffer
– Supplements things like unit testing, runtime testing, Valgrind, etc.
5 Samsung Open Source Group
6 Samsung Open Source Group
– Clang Static Analyzer – Klocwork used internally (not allowed to share results) – finally settled for Coverity Scan service
7 Samsung Open Source Group
8 Samsung Open Source Group
9 Samsung Open Source Group
10 Samsung Open Source Group
Analyser OSS Defect database Web UI False positive ratio Sparse
To be tested Clang Static Analyzer
Noisy CodeChecker
To be tested Coverity
beer service
Good Klocwork
Good
11 Samsung Open Source Group
12 Samsung Open Source Group
13 Samsung Open Source Group
14 Samsung Open Source Group
15 Samsung Open Source Group
16 Samsung Open Source Group
17 Samsung Open Source Group
18 Samsung Open Source Group
19 Samsung Open Source Group
20 Samsung Open Source Group
21 Samsung Open Source Group
22 Samsung Open Source Group
23 Samsung Open Source Group
24 Samsung Open Source Group
FILENAME=efl-$(date -I)-$(git rev-parse --short HEAD) rm -rf cov-int ./autogen.sh --prefix="${EFL_DESTDIR}" ${config_opts} cov-build --dir cov-int make -j${PARALLEL_MAKE} tar czvf $FILENAME.tgz cov-int curl --form token=XXX --form email=stefan@datenfreihafen.org --form file=@$FILENAME.tgz --for m version=$FILENAME --form description=$FILENAME https://scan.coverity.com/builds?project=Enli ghtenment+Foundation+Libraries make -j${PARALLEL_MAKE} distclean
25 Samsung Open Source Group
26 Samsung Open Source Group
– Simple regex patterns to sort files into categories – Useful for large code bases – Useful for projects with many maintainers
– Helps to tune down the false positive rate – Upload a file to annotate functions without implementation
– I had no need for it until now
27 Samsung Open Source Group
– Better use the modeling file (keeps code clean) – +kill (always aborts), +alloc (allocates memory), +free (frees argument)
/* coverity[+free : arg-0] */ void local_free(void *to_be_freed) { … }
28 Samsung Open Source Group
29 Samsung Open Source Group
Foundation Libraries
to 0.18
big > 500k LOC and thus can only run 4 times a week)
which are actively being worked on
30 Samsung Open Source Group
– To much load towards the scan service – Incremental checks would be interesting as well
31 Samsung Open Source Group
32 Samsung Open Source Group
33 Samsung Open Source Group
34 Samsung Open Source Group
– Most likely overkill and will not really work well with
– Only works with git – The way the Travis CI plugin works – Maybe interesting for testing review branches
35 Samsung Open Source Group
36 Samsung Open Source Group
37 Samsung Open Source Group
– Not seen to often if you regularly run your code
– Good to find those early-on instead of having to go
38 Samsung Open Source Group
39 Samsung Open Source Group
40 Samsung Open Source Group
41 Samsung Open Source Group