Subject: Re: kern/34892: panic: lockmgr: no context, when freeing sigacts in exit1()
To: None <gnats-bugs@NetBSD.org>
From: Andrew Doran <ad@netbsd.org>
List: netbsd-bugs
Date: 03/07/2007 16:37:54
I closed 35886 as a dup and added Chuck to the Notify-List. As noted in
35886 the problem no longer exists in -current.

> cpu_Debugger(ce3eda0c,e044,ce3eda2c,ce3eda18,10022) at netbsd:cpu_Debugger+0x4
> panic(c07f874b,e09934b4,ce3eda5c,c036a31c,ce3eda48) at netbsd:panic+0x141
> lockmgr(c08de9a4,10022,c08dea4c,81,c263f780) at netbsd:lockmgr+0x861
[...]
> sigactsfree(fac40404,cf7db350,ce3edbfc,c03dc5af,1000) at netbsd:sigactsfree+0x2a
> exit1(de5eaf50,0,e32c8d0c,de5eaf50,0) at netbsd:exit1+0x3ca
> sys_exit(de5eaf50,ce3edc48,ce3edc68,0,bbbcc000) at netbsd:sys_exit+0x31
> syscall_plain() at netbsd:syscall_plain+0x155
> --- syscall (number 1) ---

There are problems with the following:

    537 	/* Release substructures */
    538 	sigactsfree(ps);
    539 	limfree(plim);
    540 	pstatsfree(pstats);
    541 
    542 	/* Release cached credentials. */
    543 	kauth_cred_free(l->l_cred);

- Current has the SDYING state, which gets set early in exit1(). If
  we add it to 4.0BETA_2 and make dying processes not be inspected for
  signals the sigactsfree() can be moved earlier.

- The kauth_cred_free() can be moved back earlier, at least before
  "s = proclist_lock_write()".

- The limits are used by mi_switch() so I think the easiest fix there
  is to defer releasing them until proc_free().

- I'm unsure about the stats, but again it seems like the easiest fix
  is to release them in proc_free().

Andrew