smatch question
Dan Carpenter
dan.carpenter at oracle.com
Fri Apr 25 02:11:59 PDT 2014
On Thu, Apr 24, 2014 at 04:04:17PM -0700, Artem Bityutskiy wrote:
> Hi Dan,
>
> could you please remind what is the kernel data smatch needs, how
> important is it to have it, how to create it and maintain up-to-date?
>
> Also, I am getting a lot of
>
>
> Warning: /home/dedekind/share/smatch/smatch_data/ is not accessible.
> Use --no-data or --data to suppress this message.
>
> And I am suppressing this with --no-data, but I'd prefer to use '-q' or
> '--quiet' instead, which would ask smatch to use the data if it is
> available, or just keep silence if it is not, and avoid printing the
> warning. Would this make sense?
>
Those are good questions.
I really intended that people would always use the data directory. I'm
pretty sure that if you don't have it then you end up with bogus output.
Just from a quick glance, these files are important:
kernel.ignored_macros
kernel.silenced_functions
kernel.no_return_funcs
I think that adding a --quiet is probably a mistake. Use the
--data=<dir> option to specify where the data directory is instead.
Most of the other files are for specific checks. All the checks assume
that they will find their data. I should write them so that they handle
it correctly when the data isn't there... I haven't worried about this
before.
The smatch_scripts/build_kernel_data.sh script will update the
smatch_data/ directory.
That script also builds the cross function database so it takes a while
to run. I should mention here that I keep moving information from the
smatch_data/ directory into the database.
Have people been using the database? It's really great! For example,
http://www.spinics.net/lists/stable/msg43121.html
In that patch Andy adds a fix for the case where nlh->nlmsg_type is less
than 16 and it leads to a read underflow. But if he had had the cross
function db set up then he could have typed `smdb crypto_user_rcv_msg`
and it shows this information:
net/netlink/af_netlink.c | netlink_rcv_skb | netlink_rcv_skb param 1 | PARAM_VALUE | 1 | $$->nlmsg_type | 16-u16max
In other words, crypto_user_rcv_msg is called from netlink_rcv_skb() and
->nlmsg_type is in the 16-u16max range.
regards,
dan carpenter
More information about the aiaiai
mailing list