Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jun 1995 22:50:06 +0800 (WST)
From:      Peter Wemm <peter@haywire.DIALix.COM>
To:        current@freebsd.org
Subject:   bug in Linux^H^H^H^H^HDoom Emulator
Message-ID:  <Pine.SV4.3.91.950626224220.12512A-100000@haywire.DIALix.COM>

next in thread | raw e-mail | index | archive | help
Thanks for committing it Soren (?? is that how you write it in 7-bit ascii?).

If you compile a kernel with options DIAGNOSTIC, it running doom will 
cause a panic inside ufs_access - the vnode in the VOP_ACCESS call in
linux_misc.c is not locked at this point.

I've had a look, and based on what I saw in kern_exec.c, I suggest that 
the following patch *might* be in order...  I dont know if it's correct 
and have not yet compiled a kernel to test it, so caveat emptor!

kern_exec.c approximately does this:
NDINIT(... FOLLOW | LOCKLEAF ...)
namei(&nd).
vp = nd.....
[...]
err = VOP_ACCESS(vp)
err = VOP_OPEN(vp)
VOP_UNLOCK(vp)
err = vm_mmap(vp...)

I added LOCKLEAF and a VOP_UNLOCK() to i386/linux/linux_misc.c - I'd 
appreciate knowing if it looks right or if it's going to cause the file 
system to get eaten.. :-)

Cheers,
-Peter

(PS: Thanks for comitting it Soren! :-)

*** linux_misc.c.dist	Mon Jun 26 01:32:37 1995
--- linux_misc.c	Mon Jun 26 22:38:41 1995
***************
*** 188,194 ****
      printf("Linux-emul(%d): uselib(%s)\n", p->p_pid, path);
  #endif
  
!     NDINIT(&ni, LOOKUP, FOLLOW, UIO_SYSSPACE, path, p);
      if (error = namei(&ni))
  	return error;
  
--- 188,194 ----
      printf("Linux-emul(%d): uselib(%s)\n", p->p_pid, path);
  #endif
  
!     NDINIT(&ni, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, path, p);
      if (error = namei(&ni))
  	return error;
  
***************
*** 215,220 ****
--- 215,222 ----
  
      if (error = VOP_OPEN(vnodep, FREAD, p->p_ucred, p))
  	return error;
+ 
+     VOP_UNLOCK(vnodep);	/* lock no longer needed */
  
      error = vm_mmap(kernel_map, (vm_offset_t *)&a_out, 1024,
  	    	    VM_PROT_READ, VM_PROT_READ, 0, (caddr_t)vnodep, 0);




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.91.950626224220.12512A-100000>