aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1995-10-04 07:08:04 +0000
committerJulian Elischer <julian@FreeBSD.org>1995-10-04 07:08:04 +0000
commit00c6cadad3396d723b9a89413a466d7e6dfbcf5e (patch)
tree13b3cc3a88a765c323824c4ebcd474c601d44fea /sys/compat
parent16b04b6ae73f39efbd13aa8faee2e5d859f0e6f4 (diff)
downloadsrc-00c6cadad3396d723b9a89413a466d7e6dfbcf5e.tar.gz
src-00c6cadad3396d723b9a89413a466d7e6dfbcf5e.zip
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...
Notes
Notes: svn path=/head/; revision=11163
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_misc.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index bf40786e28a8..a9f7e0b594fd 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;