I get a segv in rump_init with my threading code,

Program received signal SIGSEGV, Segmentation fault.
rump_softint_run (ci=<optimised out>) at
/home/justin/rump/librumpfiber/buildrump.sh/src/sys/rump/librump/rumpkern/intr.c:360
360 if (!LIST_EMPTY(&si_lvl[i].si_pending))
(gdb) bt
#0  rump_softint_run (ci=<optimised out>) at
/home/justin/rump/librumpfiber/buildrump.sh/src/sys/rump/librump/rumpkern/intr.c:360
#1  0x00007ffff6ff6bdf in rump_unschedule_cpu_interlock (l=0x6e1800,
interlock=0x0)
    at 
/home/justin/rump/librumpfiber/buildrump.sh/src/sys/rump/librump/rumpkern/scheduler.c:422
#2  0x00007ffff6d58078 in rumpkern_unsched (nlocks=0x7fffffffd684,
interlock=0x0) at librumpfiber/rumpuser_int.h:42
#3  0x00007ffff6d582a8 in rumpuser_thread_create (f=0x7ffff6ff5de0
<threadbouncer>, arg=0x6c61b0, thrname=0x7fffffffd6c0 "rsi0/1",
    joinable=0, pri=-1, cpuidx=0, tptr=tptr@entry=0x6e59b8) at
librumpfiber/rumpfiber_synch.c:102
#4  0x00007ffff6ff61c0 in kthread_create (pri=-1, flags=<optimised
out>, ci=0x7ffff7246ec0, func=0x7ffff6ff8d40 <sithread>,
    arg=<optimised out>, newlp=0x0, fmt=0x7ffff700cd1d "rsi%d/%d")
    at 
/home/justin/rump/librumpfiber/buildrump.sh/src/sys/rump/librump/rumpkern/threads.c:211
#5  0x00007ffff6ff89d2 in sithread_establish (level=1)
    at 
/home/justin/rump/librumpfiber/buildrump.sh/src/sys/rump/librump/rumpkern/intr.c:217
#6  0x00007ffff6ff8b78 in softint_init (ci=0x7ffff7246ec0)
    at 
/home/justin/rump/librumpfiber/buildrump.sh/src/sys/rump/librump/rumpkern/intr.c:260
#7  0x00007ffff6ff9830 in rump_init () at
/home/justin/rump/librumpfiber/buildrump.sh/src/sys/rump/librump/rumpkern/rump.c:352

So softint_run is indirectly being called before softint_init is
actually finished. Surprised has not shown up elsewhere.

This patch fixes the issue by skipping softint_run if not initialised
properly, is that a sane approach?

diff --git a/sys/rump/librump/rumpkern/intr.c b/sys/rump/librump/rumpkern/intr.c
index 92b98ae..c44dea0 100644
--- a/sys/rump/librump/rumpkern/intr.c
+++ b/sys/rump/librump/rumpkern/intr.c
@@ -356,6 +356,10 @@ rump_softint_run(struct cpu_info *ci)
  if (!rump_threads)
  return;

+ /* XXX bug? This is called after incomplete initialization it seems */
+ if (!si_lvl)
+ return;
+
  for (i = 0; i < SOFTINT_COUNT; i++) {
  if (!LIST_EMPTY(&si_lvl[i].si_pending))
  rumpuser_cv_signal(si_lvl[i].si_cv);

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
rumpkernel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rumpkernel-users

Reply via email to