Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern If we already have an entry for the file being load...
details: https://anonhg.NetBSD.org/src/rev/78ce624658a3
branches: trunk
changeset: 337749:78ce624658a3
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Apr 26 09:16:06 2015 +0000
description:
If we already have an entry for the file being loaded, return EEXIST, don't
silently skip it.
diffstat:
sys/kern/kern_veriexec.c | 33 ++++++---------------------------
1 files changed, 6 insertions(+), 27 deletions(-)
diffs (61 lines):
diff -r 393f661b8347 -r 78ce624658a3 sys/kern/kern_veriexec.c
--- a/sys/kern/kern_veriexec.c Sun Apr 26 08:56:19 2015 +0000
+++ b/sys/kern/kern_veriexec.c Sun Apr 26 09:16:06 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_veriexec.c,v 1.5 2015/04/25 19:10:29 maxv Exp $ */
+/* $NetBSD: kern_veriexec.c,v 1.6 2015/04/26 09:16:06 maxv Exp $ */
/*-
* Copyright (c) 2005, 2006 Elad Efrat <elad%NetBSD.org@localhost>
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_veriexec.c,v 1.5 2015/04/25 19:10:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_veriexec.c,v 1.6 2015/04/26 09:16:06 maxv Exp $");
#include "opt_veriexec.h"
@@ -1195,7 +1195,7 @@
veriexec_file_add(struct lwp *l, prop_dictionary_t dict)
{
struct veriexec_table_entry *vte;
- struct veriexec_file_entry *vfe = NULL, *hh;
+ struct veriexec_file_entry *vfe = NULL;
struct vnode *vp;
const char *file, *fp_type;
int error;
@@ -1242,30 +1242,9 @@
rw_enter(&veriexec_op_lock, RW_WRITER);
- /*
- * See if we already have an entry for this file. If we do, then
- * let the user know and silently pretend to succeed.
- */
- hh = veriexec_get(vp);
- if (hh != NULL) {
- bool fp_mismatch;
-
- if (strcmp(vfe->ops->type, fp_type) ||
- memcmp(hh->fp, vfe->fp, hh->ops->hash_len))
- fp_mismatch = true;
- else
- fp_mismatch = false;
-
- if ((veriexec_verbose >= 1) || fp_mismatch) {
- log(LOG_NOTICE, "Veriexec: Duplicate entry for `%s' "
- "ignored. (%s fingerprint)\n", file,
- fp_mismatch ? "different" : "same");
- }
-
- veriexec_file_free(vfe);
-
- /* XXX Should this be EEXIST if fp_mismatch is true? */
- error = 0;
+ if (veriexec_get(vp)) {
+ /* We already have an entry for this file. */
+ error = EEXIST;
goto unlock_out;
}
Home |
Main Index |
Thread Index |
Old Index