Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/sys/kern Apply patch (requested by elad in ticket #891):
details: https://anonhg.NetBSD.org/src/rev/997eded8e108
branches: netbsd-3
changeset: 577375:997eded8e108
user: riz <riz%NetBSD.org@localhost>
date: Sat Oct 15 21:32:34 2005 +0000
description:
Apply patch (requested by elad in ticket #891):
Fix a crash whenever the nameidata has the pathname in userspace.
diffstat:
sys/kern/vfs_vnops.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diffs (68 lines):
diff -r 2b29b6aeeb5b -r 997eded8e108 sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c Sat Oct 15 21:03:51 2005 +0000
+++ b/sys/kern/vfs_vnops.c Sat Oct 15 21:32:34 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_vnops.c,v 1.86.2.8 2005/09/08 21:06:31 tron Exp $ */
+/* $NetBSD: vfs_vnops.c,v 1.86.2.9 2005/10/15 21:32:34 riz Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.86.2.8 2005/09/08 21:06:31 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.86.2.9 2005/10/15 21:32:34 riz Exp $");
#include "opt_verified_exec.h"
@@ -106,6 +106,21 @@
int error;
#ifdef VERIFIED_EXEC
struct veriexec_hash_entry *vhe = NULL;
+ char pathbuf[MAXPATHLEN];
+ size_t pathlen;
+ int (*copyfun)(const void *, void *, size_t, size_t *) =
+ ndp->ni_segflg == UIO_SYSSPACE ? copystr : copyinstr;
+#endif /* VERIFIED_EXEC */
+
+#ifdef VERIFIED_EXEC
+ error = (*copyfun)(ndp->ni_dirp, pathbuf, sizeof(pathbuf), &pathlen);
+ if (error) {
+ if (veriexec_verbose >= 1)
+ printf("veriexec: Can't copy path. (error=%d)\n",
+ error);
+
+ return (error);
+ }
#endif /* VERIFIED_EXEC */
restart:
@@ -125,7 +140,7 @@
printf("Veriexec: vn_open: Preventing "
"new file creation in %s.\n",
- ndp->ni_dirp);
+ pathbuf);
vp = ndp->ni_dvp;
error = EPERM;
@@ -193,8 +208,7 @@
if ((fmode & O_CREAT) == 0) {
#ifdef VERIFIED_EXEC
- /* XXX may need pathbuf instead */
- if ((error = veriexec_verify(p, vp, &va, ndp->ni_dirp,
+ if ((error = veriexec_verify(p, vp, &va, pathbuf,
VERIEXEC_FILE, &vhe)) != 0)
goto bad;
#endif
@@ -215,7 +229,7 @@
#ifdef VERIFIED_EXEC
if (vhe != NULL) {
veriexec_report("Write access request.",
- ndp->ni_dirp, &va, p,
+ pathbuf, &va, p,
REPORT_NOVERBOSE,
REPORT_ALARM,
REPORT_NOPANIC);
Home |
Main Index |
Thread Index |
Old Index