DragonFly BSD
DragonFly bugs List (threaded) for 2003-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: panic truss'ing linux ls


To: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
From: Kip Macy <kmacy@xxxxxxxxxxx>
Date: Sun, 9 Nov 2003 19:41:33 -0800

fp->f_data is null, this tiny patch works around the problem

The real problem is we have a file pointer marked as a vnode
that isn't - that will require some delving - this patch at
least prevents people's systems from crashing in the meantime


			-Kip


On Sun, 9 Nov 2003, Matthew Dillon wrote:

>
> :...
> :so I tried trussing it. Same panic. It looks like I may be to blame as
> :it is dying in elf_putfiles, which is code added to core dump for
> :checkpointing. I'll see if it is anything obvious.
>
>     Hmm.  Either fp->f_data is NULL or vp->v_mount is NULL on line
>     1256 of imgact_elf.c.
>
>
> 					-Matt
>
> :> #6  0xc0174e2b in elf_putfiles (p=0xcdd5fc40, dst=0xce148000, off=0xce601a14)
> :>     at /home/source/dragonfly/src/sys/kern/imgact_elf.c:1256
> :> #7  0xc0174bb3 in elf_puthdr (p=0xcdd5fc40, dst=0xce148000, off=0xce601a14, status=0xc7c91d10,
> :>     fpregset=0xc7c91d78, psinfo=0xc7c91e28, numsegs=10)
> :...
> :> (kgdb) info locals
> :> off = (int *) 0xce601a14
> :> i = 3
> :> cfh = (struct ckpt_filehdr *) 0xce148f60
> :> cfi = (struct ckpt_fileinfo *) 0x0
> :> fp = (struct file *) 0x0
> :> vp = (struct vnode *) 0x0
>
>     These may not be accurate due to compiler optimizations.  In fact, fp
>     cannot be NULL because the other cfi-> assignments succeeded prior to
>     the fatal trap.
>
>     You need to dereference p->p_fd->fd_ofiles[i] to get an accurate fp
>     and from there you can figure out what is going on.
>
> 					-Matt
> 					Matthew Dillon
> 					<dillon@xxxxxxxxxxxxx>
>
Index: sys/kern/imgact_elf.c
===================================================================
RCS file: /home/dcvs/src/sys/kern/imgact_elf.c,v
retrieving revision 1.12
diff -u -b -B -r1.12 imgact_elf.c
--- sys/kern/imgact_elf.c	20 Oct 2003 06:50:51 -0000	1.12
+++ sys/kern/imgact_elf.c	9 Nov 2003 19:32:57 -0000
@@ -1247,12 +1247,19 @@
 		if (fp->f_type != DTYPE_VNODE)
 			continue;
 		if (dst) {
+			vp = (struct vnode *)fp->f_data;
+			/* it looks like a bug in ptrace is marking 
+			 * a non-vnode as a vnode - until we find the 
+			 * root cause this will at least prevent
+			 * further panics from truss
+			 */
+			if (vp == NULL)
+			        continue;
 			cfh->cfh_nfiles++;
 			cfi = (struct ckpt_fileinfo *)((char *)dst + *off);
 			cfi->cfi_index = i;
 			cfi->cfi_flags = fp->f_flag;
 			cfi->cfi_offset = fp->f_offset;
-			vp = (struct vnode *)fp->f_data;
 			cfi->cfi_fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
 			error = VFS_VPTOFH(vp, &cfi->cfi_fh.fh_fid);
 		}


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]