Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern - check for errors in exec_resolvename() and fail
details: https://anonhg.NetBSD.org/src/rev/04fa34573133
branches: trunk
changeset: 744705:04fa34573133
user: christos <christos%NetBSD.org@localhost>
date: Mon Feb 10 22:13:01 2020 +0000
description:
- check for errors in exec_resolvename() and fail
- put back the compat_linux modules in the exec array (commented out)
- remove extra parens
diffstat:
sys/kern/kern_exec.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diffs (75 lines):
diff -r 2190eaadae7a -r 04fa34573133 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c Mon Feb 10 22:11:09 2020 +0000
+++ b/sys/kern/kern_exec.c Mon Feb 10 22:13:01 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exec.c,v 1.490 2020/01/29 15:47:52 ad Exp $ */
+/* $NetBSD: kern_exec.c,v 1.491 2020/02/10 22:13:01 christos Exp $ */
/*-
* Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.490 2020/01/29 15:47:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.491 2020/02/10 22:13:01 christos Exp $");
#include "opt_exec.h"
#include "opt_execfmt.h"
@@ -316,7 +316,7 @@
PNBUF_PUT(data->ed_resolvedname);
}
-static void
+static int
exec_resolvename(struct lwp *l, struct exec_package *epp, struct vnode *vp,
char **rpath)
{
@@ -328,13 +328,16 @@
*rpath = PNBUF_GET();
error = vnode_to_path(*rpath, MAXPATHLEN, vp, l, l->l_proc);
if (error) {
+ DPRINTF(("%s: can't resolve name for %s, error %d\n",
+ __func__, epp->ep_kname, error));
PNBUF_PUT(*rpath);
*rpath = NULL;
- return;
+ return error;
}
epp->ep_resolvedname = *rpath;
if ((p = strrchr(*rpath, '/')) != NULL)
epp->ep_kname = p + 1;
+ return 0;
}
@@ -396,7 +399,8 @@
epp->ep_vp = vp = fp->f_vnode;
vref(vp);
fd_putfile(epp->ep_xfd);
- exec_resolvename(l, epp, vp, rpath);
+ if ((error = exec_resolvename(l, epp, vp, rpath)) != 0)
+ return error;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
}
@@ -633,6 +637,10 @@
"exec_ecoff",
"compat_aoutm68k",
"compat_netbsd32",
+#if 0
+ "compat_linux",
+ "compat_linux32",
+#endif
"compat_sunos",
"compat_sunos32",
"compat_ultrix",
@@ -641,7 +649,7 @@
char const * const *list;
int i;
- list = (nexecs == 0 ? native : compat);
+ list = nexecs == 0 ? native : compat;
for (i = 0; list[i] != NULL; i++) {
if (module_autoload(list[i], MODULE_CLASS_EXEC) != 0) {
continue;
Home |
Main Index |
Thread Index |
Old Index