Fri Apr 17 13:03:38 2015 UTC ()
Don't share file descriptors between proc0 and local clients.


(pooka)
diff -r1.33 -r1.34 src/sys/rump/librump/rumpkern/lwproc.c

cvs diff -r1.33 -r1.34 src/sys/rump/librump/rumpkern/lwproc.c (expand / switch to unified diff)

--- src/sys/rump/librump/rumpkern/lwproc.c 2015/04/03 16:40:55 1.33
+++ src/sys/rump/librump/rumpkern/lwproc.c 2015/04/17 13:03:38 1.34
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lwproc.c,v 1.33 2015/04/03 16:40:55 pooka Exp $ */ 1/* $NetBSD: lwproc.c,v 1.34 2015/04/17 13:03:38 pooka Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE. 25 * SUCH DAMAGE.
26 */ 26 */
27 27
28#define RUMP__CURLWP_PRIVATE 28#define RUMP__CURLWP_PRIVATE
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.33 2015/04/03 16:40:55 pooka Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.34 2015/04/17 13:03:38 pooka Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/atomic.h> 34#include <sys/atomic.h>
35#include <sys/filedesc.h> 35#include <sys/filedesc.h>
36#include <sys/kauth.h> 36#include <sys/kauth.h>
37#include <sys/kmem.h> 37#include <sys/kmem.h>
38#include <sys/lwp.h> 38#include <sys/lwp.h>
39#include <sys/ktrace.h> 39#include <sys/ktrace.h>
40#include <sys/pool.h> 40#include <sys/pool.h>
41#include <sys/proc.h> 41#include <sys/proc.h>
42#include <sys/queue.h> 42#include <sys/queue.h>
43#include <sys/resourcevar.h> 43#include <sys/resourcevar.h>
44#include <sys/uidinfo.h> 44#include <sys/uidinfo.h>
@@ -317,27 +317,27 @@ lwproc_makelwp(struct proc *p, struct lw @@ -317,27 +317,27 @@ lwproc_makelwp(struct proc *p, struct lw
317 317
318 mutex_enter(proc_lock); 318 mutex_enter(proc_lock);
319 LIST_INSERT_HEAD(&alllwp, l, l_list); 319 LIST_INSERT_HEAD(&alllwp, l, l_list);
320 mutex_exit(proc_lock); 320 mutex_exit(proc_lock);
321} 321}
322 322
323struct lwp * 323struct lwp *
324rump__lwproc_alloclwp(struct proc *p) 324rump__lwproc_alloclwp(struct proc *p)
325{ 325{
326 struct lwp *l; 326 struct lwp *l;
327 bool newproc = false; 327 bool newproc = false;
328 328
329 if (p == NULL) { 329 if (p == NULL) {
330 p = lwproc_newproc(&proc0, rump_vmspace_local, 0); 330 p = lwproc_newproc(&proc0, rump_vmspace_local, RUMP_RFCFDG);
331 newproc = true; 331 newproc = true;
332 } 332 }
333 333
334 l = kmem_zalloc(sizeof(*l), KM_SLEEP); 334 l = kmem_zalloc(sizeof(*l), KM_SLEEP);
335 335
336 mutex_enter(p->p_lock); 336 mutex_enter(p->p_lock);
337 KASSERT((p->p_sflag & PS_RUMP_LWPEXIT) == 0); 337 KASSERT((p->p_sflag & PS_RUMP_LWPEXIT) == 0);
338 lwproc_makelwp(p, l, false, newproc); 338 lwproc_makelwp(p, l, false, newproc);
339 339
340 return l; 340 return l;
341} 341}
342 342
343int 343int