Subject: kern/36495: panic: KDASSERT, line 1410 kern/kern_sa.c, rev 1.50.2.2
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <velsub-15@imstations.com>
List: netbsd-bugs
Date: 06/15/2007 19:20:00
>Number:         36495
>Category:       kern
>Synopsis:       panic: KDASSERT, line 1410 kern/kern_sa.c, rev 1.50.2.2
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 15 19:20:00 +0000 2007
>Originator:     Vel Scott
>Release:        2.0.3
>Organization:
River Wild
>Environment:
NetBSD netbsd-ITIBASHI-1 2.0.3 NetBSD 2.0.3 (ITABASHI) #0: Tue May 15 10:28:50 PST 2007 build@localhost:/home/build/usr/src/sys/arch/lpuxi386/compile/ITABASHI lpuxi386
>Description:
panic: kernel debugging assertion "sau->sau_interrupted.ss_captured.ss_sa.sa_con
text != sau->sau_event.ss_captured.ss_sa.sa_context" failed: file "../../../../k
ern/kern_sa.c", line 1410
>How-To-Repeat:

1) run a multi-threaded application which calls
   1+ pthread_create();  referred to here as pid 234

2) run a tracing process that targets pid 234
   ptrace(PT_ATTACH, 234, 0, 0)  OK
   waidpid(234, x, x)  OK
   ptrace(PT_GETREGS, 234, 0, 0)  OK

   ptrace(PT_SETREGS, 234, 0, 0)  returns -1, errno EBUSY
      no lwpid is specified when the last arg is 0,
      so the system finds a representative lwp and passes
      that to process_doregs(), which returns EBUSY due to
      (l->l_stat != LSSTOP);

   instead, first lookup an array of struct kinfo_lwp with sysctl()
   (or libkvm) and choose an lwp with l_stat equal to LSSTOP;
   common example: l_lid 2, the revised syscall is:

   ptrace(PT_SETREGS, 234, 0, 2)  OK

   although this ptrace() returns success as expected,
   the system panics every time with an assertion failure
   at line 1410 kern_sa.c


The objective is a fix or workaround where PT_SETREGS works
with an mt-app and does not lead to a panic.

>Fix: