[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GCC plugin to add warnings: testing on grub
From: |
Pierre Vittet |
Subject: |
GCC plugin to add warnings: testing on grub |
Date: |
Thu, 11 Aug 2011 14:34:28 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110705 Thunderbird/3.1.11 |
Hello,
My name is Pierre Vittet, I am working on a GCC plugin (for a GSOC),
named Talpo, which allows the user to add specific compiler warnings,
adapted to a project.
I had an interesting talk with Vladimir Serbinenko during the LSM
(http://2011.rmll.info/?lang=en) which encouraged me to run some tests
on grub.
For the moment there is 3 kind of possible tests in Talpo:
-test_null : Test that a call to a given function is followed by a test
on his returned pointer, else return a warning.
-test_followed_by : Test that in a same function body, when we have a
call to a given function, we also have a call to another given function,
else return a warning.
-test_immediately_followed_by : Test that a call to a given function, is
immediately followed by a call to another given function, else, return a
warning.
I have launched the following tests when compiling grub:
(testNull "grub_malloc")
(testNull "grub_strdup")
(testNull "grub_bufio_open")
(testFollowedBy "grub_bufio_open" 0 "grub_bufio_close" 1)
You can found compilation log at :
http://pvittet.com/GSOC/log_grub_talpo.txt (too big to be in attachment).
The 3 first tests, means that we want to check that the pointer returned
by grub_malloc, grub_strdup, grub_bufio_open are tested to be (not)
null. They return quite a lot of warnings which looks pertinent to me
(even if a few are not).
Test 4 means that when we have a call to grub_bufio_open, we want in the
same function to have a grub_bufio_close on the variable returned by
grub_bufio_open. The 0 means that we focus on the returned variable of
grub_bufio_open and the 1 means that we want this variable to be first
argument of a grub_bufio_close. I got two warnings, one is a false one
(in term of logical, in function grub_buffile_open we do not want to
close buffer after opening it). The second one is more interesting (in
grub_net_fs_open in grub-core/net/net.c). We don't call
grub_buffile_close but directly free file, so we might not correctly
free field file->data.
Talpo is not made to be "false warnings free" but should be right in
most case, I am still improving it to restrict as much as possible false
positives. What I need is to find useful tests, so if you have an idea
of what would be pertinent to test in grub, I would like to launch the
tests. Talpo is available under GPL here: https://gitorious.org/talpo.
However it needs MELT (http://gcc-melt.org/) to works. MELT is actually
in an unstable state and should wait until the end of the month before
the 0.9 release go out. So I cannot advise you to have a try now except
if you have time to spend for MELT.
I hope this project sounds interesting to you!
Thanks!
Pierre Vittet
PS: I runned my test on revision 3398 of grub. I had to disable -g flags
when compiling (because it adds informations in GCC intermediate
representation) which interfered with my plugin.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- GCC plugin to add warnings: testing on grub,
Pierre Vittet <=