Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys PR/49287: Masao Uebayashi: Handle exec_script argument v...
details: https://anonhg.NetBSD.org/src/rev/3a17d818d26a
branches: trunk
changeset: 334907:3a17d818d26a
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 14 21:35:24 2014 +0000
description:
PR/49287: Masao Uebayashi: Handle exec_script argument vector from the 32 ->
64 bit case. When execing a 64 bit shell from a 32 bit binary the argument
vector was still incorrect.
XXX: Pullup 7
diffstat:
sys/kern/kern_exec.c | 16 +++++++++++-----
sys/sys/exec.h | 3 ++-
2 files changed, 13 insertions(+), 6 deletions(-)
diffs (70 lines):
diff -r 1011b838f7ee -r 3a17d818d26a sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c Sun Dec 14 21:27:49 2014 +0000
+++ b/sys/kern/kern_exec.c Sun Dec 14 21:35:24 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exec.c,v 1.410 2014/11/09 17:50:01 maxv Exp $ */
+/* $NetBSD: kern_exec.c,v 1.411 2014/12/14 21:35:24 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.410 2014/11/09 17:50:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.411 2014/12/14 21:35:24 christos Exp $");
#include "opt_exec.h"
#include "opt_execfmt.h"
@@ -673,7 +673,7 @@
epp->ep_emul_arg_free = NULL;
memset(&epp->ep_vmcmds, 0, sizeof(epp->ep_vmcmds));
epp->ep_vap = &data->ed_attr;
- epp->ep_flags = 0;
+ epp->ep_flags = (p->p_flag & PK_32) ? EXEC_FROM32 : 0;
MD_TOPDOWN_INIT(epp);
epp->ep_emul_root = NULL;
epp->ep_interp = NULL;
@@ -1335,9 +1335,15 @@
}
static size_t
+fromptrsz(const struct exec_package *epp)
+{
+ return (epp->ep_flags & EXEC_FROM32) ? sizeof(int) : sizeof(char *);
+}
+
+static size_t
ptrsz(const struct exec_package *epp)
{
- return (epp->ep_flags & EXEC_32) ? sizeof(int) : sizeof(char *);
+ return (epp->ep_flags & EXEC_32) ? sizeof(int) : sizeof(char *);
}
static size_t
@@ -1508,7 +1514,7 @@
return EINVAL;
}
if (epp->ep_flags & EXEC_SKIPARG)
- args = (const void *)((const char *)args + ptrsz(epp));
+ args = (const void *)((const char *)args + fromptrsz(epp));
i = 0;
error = copyinargstrs(data, args, fetch_element, &dp, &i, ktr_execarg);
if (error != 0) {
diff -r 1011b838f7ee -r 3a17d818d26a sys/sys/exec.h
--- a/sys/sys/exec.h Sun Dec 14 21:27:49 2014 +0000
+++ b/sys/sys/exec.h Sun Dec 14 21:35:24 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.h,v 1.146 2014/09/05 05:42:50 matt Exp $ */
+/* $NetBSD: exec.h,v 1.147 2014/12/14 21:35:24 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -230,6 +230,7 @@
#define EXEC_32 0x0020 /* 32-bit binary emulation */
#define EXEC_FORCEAUX 0x0040 /* always use ELF AUX vector */
#define EXEC_TOPDOWN_VM 0x0080 /* may use top-down VM layout */
+#define EXEC_FROM32 0x0100 /* exec'ed from 32-bit binary */
struct exec_vmcmd {
int (*ev_proc)(struct lwp *, struct exec_vmcmd *);
Home |
Main Index |
Thread Index |
Old Index