0

Yesterday I asked question on stackoverflow, but I have not described it clearly, so I change the way to ask, maybe make the problem clear. First, I modify the example get_sign.c which the klee provide, I include the unistd.h in the program, and call the function sleep() to make the thread pause, as follows

/*
 * First KLEE tutorial: testing a small function
 */
#include <unistd.h>

int get_sign(int x) {
  if (x == 0)
     return 0;

  if (x < 0)
     return -1;
  else 
     return 1;
} 

int main() {
  int a;
  klee_make_symbolic(&a, sizeof(a), "a");
  sleep(10);
  return get_sign(a);
} 

I use the "llvm-gcc" compile the get_sign.c, then use klee get_sign.o to execute the objectfile, the thread do not pause, means the sleep() does not work. so I add a argument when I execute the get_sign.o, like this klee --libc=uclibc get_sign.o, unfortunately, the thread still don't suspend, moreover, the klee reports a error,

KLEE: ERROR: /home/lab/work/klee-uclibc/libc/signal/sigaction.c:58: failed external call: __syscall_rt_sigaction

KLEE: NOTE: now ignoring this error at this location

What can I do to solve this problem? thank you!

wangxf
  • 160
  • 1
  • 11

1 Answers1

0

Looks like klee uses signals which can make sleep return sooner than expected, as indicated in http://www.delorie.com/gnu/docs/glibc/libc_445.html. This reference also provides ways to go around the limitation.

SleuthEye
  • 14,379
  • 2
  • 32
  • 61