Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/sys/kern Pull up following revision(s) (requested by mart...
details: https://anonhg.NetBSD.org/src/rev/c28ec1a15513
branches: netbsd-6
changeset: 773915:c28ec1a15513
user: riz <riz%NetBSD.org@localhost>
date: Sat Mar 10 16:49:01 2012 +0000
description:
Pull up following revision(s) (requested by martin in ticket #107):
sys/kern/kern_exec.c: revision 1.345
sys/kern/kern_exec.c: revision 1.346
Make sure the child of a posix_spawn operation is not preempted during
the times when it does not have any vm_space.
Should fix PR kern/46153.
Remove a KPREEMPT_ENABLE() in an error path I overlooked in the previous
change - pointed out by Manuel Bouyer.
While there, add a KASSERT() to make sure we have preemption enabled in
the success case.
diffstat:
sys/kern/kern_exec.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (71 lines):
diff -r 908494019fc6 -r c28ec1a15513 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c Sat Mar 10 16:46:45 2012 +0000
+++ b/sys/kern/kern_exec.c Sat Mar 10 16:49:01 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exec.c,v 1.339.2.2 2012/02/22 18:43:35 riz Exp $ */
+/* $NetBSD: kern_exec.c,v 1.339.2.3 2012/03/10 16:49:01 riz 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.339.2.2 2012/02/22 18:43:35 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.339.2.3 2012/03/10 16:49:01 riz Exp $");
#include "opt_exec.h"
#include "opt_ktrace.h"
@@ -1778,11 +1778,13 @@
register_t retval;
bool have_reflock;
+ /* we have been created non-preemptable */
+ KASSERT(l->l_nopreempt == 1);
+
/*
* The following actions may block, so we need a temporary
* vmspace - borrow the kernel one
*/
- KPREEMPT_DISABLE(l);
l->l_proc->p_vmspace = proc0.p_vmspace;
pmap_activate(l);
KPREEMPT_ENABLE(l);
@@ -1908,8 +1910,6 @@
KPREEMPT_DISABLE(l);
pmap_deactivate(l);
l->l_proc->p_vmspace = NULL;
- KPREEMPT_ENABLE(l);
-
/* now do the real exec */
rw_enter(&exec_lock, RW_READER);
@@ -1920,6 +1920,10 @@
else if (error)
goto report_error;
+ /* we now have our own vmspace */
+ KPREEMPT_ENABLE(l);
+ KASSERT(l->l_nopreempt == 0);
+
/* done, signal parent */
mutex_enter(&spawn_data->sed_mtx_child);
cv_signal(&spawn_data->sed_cv_child_ready);
@@ -1940,7 +1944,7 @@
KPREEMPT_DISABLE(l);
pmap_deactivate(l);
l->l_proc->p_vmspace = NULL;
- KPREEMPT_ENABLE(l);
+ /* do not enable preemption without vmspace */
}
/*
@@ -2269,6 +2273,8 @@
kauth_cred_free(ocred);
}
+ l2->l_nopreempt = 1; /* start it non-preemptable */
+
/*
* It's now safe for the scheduler and other processes to see the
* child process.
Home |
Main Index |
Thread Index |
Old Index