Fix of panic that was introduced since ktrace-lwp branch was merged. The
shortcut to the process of the passed lwp paniced the kernel since lwp could/can be passwd as NULL in VOP_WRITE(). This was happening when ktracing to NFS. The function ktrwrite() set the uio_lwp to NULL and then calls VOP_WRITE() with this argument. nfs_write() then accessed lwp *l->l_proc wich paniced. Thanks to David Laight for his help on tracking it down.
This commit is contained in:
parent
e35adea403
commit
255662c92a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_ktrace.c,v 1.98 2005/12/11 12:24:29 christos Exp $ */
|
||||
/* $NetBSD: kern_ktrace.c,v 1.99 2005/12/13 13:12:18 reinoud Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.98 2005/12/11 12:24:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.99 2005/12/13 13:12:18 reinoud Exp $");
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
#include "opt_compat_mach.h"
|
||||
|
@ -1127,7 +1127,7 @@ next:
|
|||
auio.uio_rw = UIO_WRITE;
|
||||
auio.uio_resid = 0;
|
||||
auio.uio_iovcnt = 0;
|
||||
auio.uio_lwp = NULL;
|
||||
auio.uio_lwp = curlwp;
|
||||
do {
|
||||
kth = &kte->kte_kth;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_bio.c,v 1.139 2005/12/11 12:25:16 christos Exp $ */
|
||||
/* $NetBSD: nfs_bio.c,v 1.140 2005/12/13 13:12:18 reinoud Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.139 2005/12/11 12:25:16 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.140 2005/12/13 13:12:18 reinoud Exp $");
|
||||
|
||||
#include "opt_nfs.h"
|
||||
#include "opt_ddb.h"
|
||||
|
@ -499,7 +499,6 @@ nfs_write(v)
|
|||
} */ *ap = v;
|
||||
struct uio *uio = ap->a_uio;
|
||||
struct lwp *l = uio->uio_lwp;
|
||||
struct proc *p = l->l_proc;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
struct ucred *cred = ap->a_cred;
|
||||
|
@ -552,9 +551,9 @@ nfs_write(v)
|
|||
* Maybe this should be above the vnode op call, but so long as
|
||||
* file servers have no limits, i don't think it matters
|
||||
*/
|
||||
if (p && uio->uio_offset + uio->uio_resid >
|
||||
p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
|
||||
psignal(p, SIGXFSZ);
|
||||
if (l && l->l_proc && uio->uio_offset + uio->uio_resid >
|
||||
l->l_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
|
||||
psignal(l->l_proc, SIGXFSZ);
|
||||
return (EFBIG);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue