weird SIGSEV

Robert Millan rmh@debian.org
Wed, 19 Jan 2005 00:46:35 +0100


Hi,

While trying to debug an unrelated problem, I found this small SIGSEV case:

#include <pthread.h>
#include <stdio.h>
#include <sys/syscall.h>

main ()
  { 
    printf ("%d\n", syscall (SYS_sched_get_priority_max, SCHED_OTHER));
    printf ("%d\n", syscall (SYS_sched_get_priority_max, SCHED_OTHER));
  }

Interestingly enough, if you replace syscall() with the Glibc
sched_get_priority_max() function stub, the error disappears.  If you remove
one of the two syscall() invocations (which are identical), the error also
disappears.  gdb doesn't seem particularly clued either (building test case
with CFLAGS="-g -static"):

[...]
Program received signal SIGSEGV, Segmentation fault.
0x00000014 in ?? ()
(gdb) bt
#0  0x00000014 in ?? ()
#1  0x7665642f in ?? ()
Error accessing memory address 0xa6425: Bad address.

Any idea?

-- 
 .''`.   Proudly running Debian GNU/kFreeBSD unstable/unreleased (on UFS2+S)
: :' :
`. `'    http://www.debian.org/ports/kfreebsd-gnu
  `-