Project

General

Profile

Actions

Bug #9131

open

Undeclared Functions in slice generated

Added by Asia . over 6 years ago. Updated over 6 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Start date:
07/19/2018
Due date:
% Done:

0%

Estimated time:
Detected in build:
svn
Platform:
Published in build:
8db135f0acb4c51e6ab2f07ff96f3f24b9f58312

Description

Currently I am working on verification of SVCOMP tasks. I am using crudeslicer plugin(Build fcd3b927) to slice the tasks using the below mentioned command:

./frama-c.native -no-autoload-plugins -no-findlib -load-module Crude_slicer.cmxs -machdep gcc_x86_64 -crude_slicer -timeout 400 -no-recognize_wrecked_container_of -widening_threshold 2000 -no-summaries -no-assert_stratification -print -ocode slice.c task.c

I am using Ubuntu 16.04 OS.

Some of the svcomp tasks have functions without declarations. But the function definitions are positioned in such a way that gcc compiler can encounter its definition before it is actually being called. So the original tasks get compiled successfully. But when we slice using crude_slicer the position of these function definition is changed and they happen to be present after call point of these functions. And their declaration is also not included by the slicer. So the slice generated is not gcc compilable.

In task.c the function __ip_vs_tcp_init is defined at line number 29810 and call points are after this line only(Ref line number 29843, 29883). This function does not have any declaration.
In slice.c the function __ip_vs_tcp_init is defined at line number 9605 and call points are 9483,9482,9685.

The GCC command I have used is gcc -c slice.c

The error trace is

.

/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c: In function ‘register_ip_vs_proto_netns’:
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:60: error: ‘__ip_vs_sctp_init’ undeclared (first use in this function)
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:60: note: each undeclared identifier is reported only once for each function it appears in
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:17: warning: implicit declaration of function ‘__ip_vs_sctp_init’ [-Wimplicit-function-declaration]
tmp___1 = ()(net, pd);
^
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:62: error: ‘__ip_vs_tcp_init’ undeclared (first use in this function)
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:19: warning: implicit declaration of function ‘__ip_vs_tcp_init’ [-Wimplicit-function-declaration]
tmp___1 = (
(pp->init_netns))(net, pd);
^
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:64: error: ‘__udp_init’ undeclared (first use in this function)
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:21: warning: implicit declaration of function ‘__udp_init’ [-Wimplicit-function-declaration]
tmp___1 = ()(net, pd);
^
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c: At top level:
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:29810:12: error: static declaration of ‘__ip_vs_tcp_init’ follows non-static declaration
static int ip_vs_tcp_init(struct net *net , struct ip_vs_proto_data *pd )
^
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:19: note: previous implicit declaration of ‘__ip_vs_tcp_init’ was here
tmp
1 = (
(pp->init_netns))(net, pd);
^
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:30742:12: error: static declaration of ‘
_udp_init’ follows non-static declaration
static int udp_init(struct net net , struct ip_vs_proto_data *pd )
^
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:21: note: previous implicit declaration of ‘__udp_init’ was here
tmp
1 = ((pp->init_netns))(net, pd);
^
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:32319:12: error: static declaration of ‘
_ip_vs_sctp_init’ follows non-static declaration
static int ip_vs_sctp_init(struct net net , struct ip_vs_proto_data *pd )
^
/home/u1364447/sv-benchmarks/c/ldv-consumption/32_7a_cilled_true-unreach-call_linux-3.8-rc1-32_7a-net--netfilter--ipvs--ip_vs.ko-ldv_main1_sequence_infinite_withcheck_stateful.cil.out.c:27997:17: note: previous implicit declaration of ‘__ip_vs_sctp_init’ was here
tmp
_1 = ((pp->init_netns))(net, pd);
^

The task.c and the respective slice.c are being attached along with frama_c_journal.ml file


Files

slice.c (356 KB) slice.c Slice generated using crude_slicer Asia ., 07/19/2018 09:16 AM
frama_c_journal.ml (1.65 KB) frama_c_journal.ml Asia ., 07/19/2018 09:16 AM
task.c (908 KB) task.c Actual source file Asia ., 07/19/2018 09:16 AM
Actions #1

Updated by Alexey Khoroshilov over 6 years ago

  • Project changed from Linux Driver Verification to Crude_slicer
Actions #2

Updated by Mikhail Mandrykin over 6 years ago

  • Status changed from New to Open
  • Published in build set to 8db135f0acb4c51e6ab2f07ff96f3f24b9f58312

The undeclared functions appeared due to indirect function call rewriting performed by the plugin. The rewriting does not, in general, preserve topological order of function calls as it adds forward calls arising from function pointer approximations. I added prototypes for the function from approximations in 4bbf73ebd64824d5e0796f9dbb9f219eca6bdf72 and also an option to disable the rewriting altogether in 8db135f0acb4c51e6ab2f07ff96f3f24b9f58312.

The plugin can be built from source e.g. by using OPAM as now described in the Wiki

Actions

Also available in: Atom PDF