From owner-freebsd-current Mon Jun 26 07:50:19 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id HAA15583 for current-outgoing; Mon, 26 Jun 1995 07:50:19 -0700 Received: from haywire.DIALix.COM (peter@haywire.DIALix.COM [192.203.228.65]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id HAA15575 for ; Mon, 26 Jun 1995 07:50:13 -0700 Received: (from peter@localhost) by haywire.DIALix.COM (8.6.12/8.6.12/DIALix) id WAA16011; Mon, 26 Jun 1995 22:50:07 +0800 Date: Mon, 26 Jun 1995 22:50:06 +0800 (WST) From: Peter Wemm To: current@freebsd.org Subject: bug in Linux^H^H^H^H^HDoom Emulator Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: current-owner@freebsd.org Precedence: bulk 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);