Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Reorder code to avoid use-after-free on error. From...
details: https://anonhg.NetBSD.org/src/rev/81efb8935025
branches: trunk
changeset: 325911:81efb8935025
user: christos <christos%NetBSD.org@localhost>
date: Sat Jan 11 16:31:20 2014 +0000
description:
Reorder code to avoid use-after-free on error. From Maxime Villard
diffstat:
sys/kern/kern_verifiedexec.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diffs (56 lines):
diff -r 23c619eb7855 -r 81efb8935025 sys/kern/kern_verifiedexec.c
--- a/sys/kern/kern_verifiedexec.c Sat Jan 11 15:51:02 2014 +0000
+++ b/sys/kern/kern_verifiedexec.c Sat Jan 11 16:31:20 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_verifiedexec.c,v 1.131 2013/11/27 17:24:44 christos Exp $ */
+/* $NetBSD: kern_verifiedexec.c,v 1.132 2014/01/11 16:31:20 christos Exp $ */
/*-
* Copyright (c) 2005, 2006 Elad Efrat <elad%NetBSD.org@localhost>
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.131 2013/11/27 17:24:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.132 2014/01/11 16:31:20 christos Exp $");
#include "opt_veriexec.h"
@@ -1309,18 +1309,6 @@
vfe->npages = 0;
vfe->last_page_size = 0;
- vte = veriexec_table_lookup(vp->v_mount);
- if (vte == NULL)
- vte = veriexec_table_add(l, vp->v_mount);
-
- /* XXX if we bail below this, we might want to gc newly created vtes. */
-
- error = fileassoc_add(vp, veriexec_hook, vfe);
- if (error)
- goto unlock_out;
-
- vte->vte_count++;
-
if (prop_bool_true(prop_dictionary_get(dict, "eval-on-load")) ||
(vfe->type & VERIEXEC_UNTRUSTED)) {
u_char *digest;
@@ -1342,6 +1330,18 @@
kmem_free(digest, vfe->ops->hash_len);
}
+ vte = veriexec_table_lookup(vp->v_mount);
+ if (vte == NULL)
+ vte = veriexec_table_add(l, vp->v_mount);
+
+ /* XXX if we bail below this, we might want to gc newly created vtes. */
+
+ error = fileassoc_add(vp, veriexec_hook, vfe);
+ if (error)
+ goto unlock_out;
+
+ vte->vte_count++;
+
veriexec_file_report(NULL, "New entry.", file, NULL, REPORT_DEBUG);
veriexec_bypass = 0;
Home |
Main Index |
Thread Index |
Old Index