sv-benchmarks
sv-benchmarks copied to clipboard
Undefined behaviour for module_get_put-drivers-char-ipmi-ipmi_watchdog.ko_true-unreach-call.cil.out.i.pp.i
@marek-trtik and I have analyzed this benchmark. Our conclusions are: each execution trace (starting in the main
function) reaches the line 6847, where is called a function ldv_initialize
. Two things apply here:
- The function
ldv_initialize
is only declaredexternal
in the benchmark, it is not defined. - There is no assumption about calling undefined function in rules of SV-COMP (https://sv-comp.sosy-lab.org/2018/rules.php).
So, the function pointer ldv_initialize
is udefined and the call ldv_initialize()
at line 6847 leads to an undefined behaviour.
Another way how to prove the presence of the undefined behaviour in the benchmark (assuming ldv_initialize
is defined as identity) is as follows:
- In the
main
function at line 6848 is called the functionipmi_wdog_init
. - In function
ipmi_wdog_init
at line 6711 we call the functionaction_op
. Important is that the first argument is the pointer to the global arrayaction
. This array was initialsed (before enteringmain
) to the stringreset
. The second argument isNULL
pointer. - When entering the function
action_op
the fist parameterinval
points to the global arrayaction
and the second parameteroutval
isNULL
. - The execution takes the
else
branch at line 6503. - The execution takes the
else
branch at line 6510. - The result from the call to
strcmp
at line 6516 returns 0, because it compares the string pointed to beinval
(i.e. the stringreset
inaction
global variable) with the string constantreset
. - The execution takes the
true
branch at line 6518. - At line 6545 there is called function
strcpy
with address ofaction
global array withinval
pointer, which contains address of the same arrayaction
. Therefore, we reach an undefined behaviour.