diff options
author | julian <julian@FreeBSD.org> | 1995-10-04 07:08:04 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1995-10-04 07:08:04 +0000 |
commit | 841d635ce3147e3f3e426c94159f1d9f1f2b236f (patch) | |
tree | 13b3cc3a88a765c323824c4ebcd474c601d44fea /sys/compat/linux/linux_misc.c | |
parent | 2ed6c5594318a1665f000c975e6a937548d2e334 (diff) | |
download | FreeBSD-src-841d635ce3147e3f3e426c94159f1d9f1f2b236f.zip FreeBSD-src-841d635ce3147e3f3e426c94159f1d9f1f2b236f.tar.gz |
Submitted by: Juergen Lock <nox@jelal.hb.north.de>
Obtained from: other people on the net ?
1. stepping over syscalls (gdb ni) sends you to DDB, and returned
to the wrong address afterwards, with or without DDB. patch in
i386/i386/trap.c below.
2. the linux emulator (modload'ed) still causes panics with DIAGNOSTIC,
re-applied a patch posted to one of the lists...
Diffstat (limited to 'sys/compat/linux/linux_misc.c')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index bf40786..a9f7e0b 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.4 1995/06/08 13:50:52 sos Exp $ + * $Id: linux_misc.c,v 1.1 1995/06/25 17:32:37 sos Exp $ */ #include <i386/linux/linux.h> @@ -188,7 +188,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args, int *retval) printf("Linux-emul(%d): uselib(%s)\n", p->p_pid, path); #endif - NDINIT(&ni, LOOKUP, FOLLOW, UIO_SYSSPACE, path, p); + NDINIT(&ni, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, path, p); if (error = namei(&ni)) return error; @@ -196,25 +196,39 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args, int *retval) if (vnodep == NULL) return ENOEXEC; - if (vnodep->v_writecount) + if (vnodep->v_writecount) { + VOP_UNLOCK(vnodep); return ETXTBSY; + } - if (error = VOP_GETATTR(vnodep, &attr, p->p_ucred, p)) - return error; + if (error = VOP_GETATTR(vnodep, &attr, p->p_ucred, p)) { + VOP_UNLOCK(vnodep); + return error; + } if ((vnodep->v_mount->mnt_flag & MNT_NOEXEC) || ((attr.va_mode & 0111) == 0) - || (attr.va_type != VREG)) + || (attr.va_type != VREG)) { + VOP_UNLOCK(vnodep); return ENOEXEC; + } - if (attr.va_size == 0) + if (attr.va_size == 0) { + VOP_UNLOCK(vnodep); return ENOEXEC; + } - if (error = VOP_ACCESS(vnodep, VEXEC, p->p_ucred, p)) + if (error = VOP_ACCESS(vnodep, VEXEC, p->p_ucred, p)) { + VOP_UNLOCK(vnodep); return error; + } - if (error = VOP_OPEN(vnodep, FREAD, p->p_ucred, p)) + if (error = VOP_OPEN(vnodep, FREAD, p->p_ucred, p)) { + VOP_UNLOCK(vnodep); 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); @@ -225,7 +239,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args, int *retval) * Is it a Linux binary ? */ if (((a_out->a_magic >> 16) & 0xff) != 0x64) - return -1; + return ENOEXEC; /* * Set file/virtual offset based on a.out variant. @@ -240,7 +254,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args, int *retval) file_offset = 0; break; default: - return (-1); + return ENOEXEC; } vnodep->v_flag |= VTEXT; |