This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug runtime/16806] New: kernel crash during repeated module insertion


https://sourceware.org/bugzilla/show_bug.cgi?id=16806

            Bug ID: 16806
           Summary: kernel crash during repeated module insertion
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: runtime
          Assignee: systemtap at sourceware dot org
          Reporter: jlebon at redhat dot com

This crash sompetimes occurs during the testsuite run of
unprivileged_myproc.exp under f19. I've been able to reproduce it more directly
as follow (files are based on loop.c and libloop.c from
testsuite/systemtap.unprivileged):

$ cat loop2.c
#include <pthread.h>
#include <unistd.h>
#include "sys/sdt.h"

extern int libloopfunc (void);

/* Thread entry point */
void *bar (void *b) {
  int i;
  int *j = (int *)b;
  for (i = 0; i < 10; ++i)
    *j += i;
 a:
  return b;
}

/* We need an inline function. */
inline int ibar (void) {
  return libloopfunc ();
}

/* We need a threaded app. */
inline int tbar (void) {
  void *x;
  int j = 0;
  STAP_PROBE(_test_, main_enter);
  pthread_t thread;
  pthread_attr_t attr;
  pthread_attr_init(&attr);
  pthread_create (& thread, & attr, bar, (void*)& j);
  pthread_join (thread, & x);
  return j;
}

main (int argc, char *argv[]) {
  int j = 0;
  for (;;) {
    j += ibar ();
    j += tbar ();
    /* Don't loop if an argument was passed */
    if (argc > 1)
      return 0;
    //usleep (250000); /* 1/4 second pause.  */
  }
  return j;
}
$
$ cat libloop.c
#include "sys/sdt.h"
#include <stdlib.h>

extern void *result;
void *result;

inline int ilibloopfunc (void) {
  int i, j = 0;
  STAP_PROBE(_test_, ilibloopfunc_enter);
  for (i = 0; i < 10; ++i)
    j += i;
  result = malloc(100); /* trigger some plt activity */
  return j;
}

int libloopfunc (void) {
  int i, j = 0;
  if (0) goto a;
 a:
  STAP_PROBE(_test_, libloopfunc_enter);
  for (i = 0; i < 10; ++i)
    j += ilibloopfunc ();
  return j;
}
$
$ gcc libloop.c -g -O -shared -fPIC -o libloop.so
$ gcc loop2.c -g -O -lpthread -lloop -L. -o loop2
$ stap --poison-cache -p4 -m loop2_mod -e 'probe
process("./loop2").function("ibar") { println("hit"); exit() }'
loop2_mod.ko
$ LD_LIBRARY_PATH=$PWD ./loop2 &
[1] 4164
$ while [ true ]; do staprun loop2_mod.ko; done
ERROR: utrace_set_events returned error -114 on pid 10935
hit
hit
ERROR: utrace_set_events returned error -114 on pid 21427
hit
hit
ERROR: utrace_set_events returned error -114 on pid 31276
hit
<kernel crash>

(The 'ERROR: utrace_set_events' messages don't always appear).

This probably has something to do with threads. Even though the function probed
is ibar(), the crash does not occur if we remove bar() & tbar().

-- 
You are receiving this mail because:
You are the assignee for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]