| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: kern_proc.c,v 1.258 2020/08/28 21:39:56 riastradh Exp $ */ | | 1 | /* $NetBSD: kern_proc.c,v 1.259 2020/08/28 22:27:51 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center, and by Andrew Doran. | | 9 | * NASA Ames Research Center, and by Andrew Doran. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -52,27 +52,27 @@ | | | @@ -52,27 +52,27 @@ |
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
59 | * SUCH DAMAGE. | | 59 | * SUCH DAMAGE. |
60 | * | | 60 | * |
61 | * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 | | 61 | * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 |
62 | */ | | 62 | */ |
63 | | | 63 | |
64 | #include <sys/cdefs.h> | | 64 | #include <sys/cdefs.h> |
65 | __KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.258 2020/08/28 21:39:56 riastradh Exp $"); | | 65 | __KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.259 2020/08/28 22:27:51 riastradh Exp $"); |
66 | | | 66 | |
67 | #ifdef _KERNEL_OPT | | 67 | #ifdef _KERNEL_OPT |
68 | #include "opt_kstack.h" | | 68 | #include "opt_kstack.h" |
69 | #include "opt_maxuprc.h" | | 69 | #include "opt_maxuprc.h" |
70 | #include "opt_dtrace.h" | | 70 | #include "opt_dtrace.h" |
71 | #include "opt_compat_netbsd32.h" | | 71 | #include "opt_compat_netbsd32.h" |
72 | #include "opt_kaslr.h" | | 72 | #include "opt_kaslr.h" |
73 | #endif | | 73 | #endif |
74 | | | 74 | |
75 | #if defined(__HAVE_COMPAT_NETBSD32) && !defined(COMPAT_NETBSD32) \ | | 75 | #if defined(__HAVE_COMPAT_NETBSD32) && !defined(COMPAT_NETBSD32) \ |
76 | && !defined(_RUMPKERNEL) | | 76 | && !defined(_RUMPKERNEL) |
77 | #define COMPAT_NETBSD32 | | 77 | #define COMPAT_NETBSD32 |
78 | #endif | | 78 | #endif |
| @@ -2566,42 +2566,42 @@ done: | | | @@ -2566,42 +2566,42 @@ done: |
2566 | kmem_free(argv, PAGE_SIZE); | | 2566 | kmem_free(argv, PAGE_SIZE); |
2567 | kmem_free(arg, PAGE_SIZE); | | 2567 | kmem_free(arg, PAGE_SIZE); |
2568 | uvmspace_free(vmspace); | | 2568 | uvmspace_free(vmspace); |
2569 | return error; | | 2569 | return error; |
2570 | } | | 2570 | } |
2571 | | | 2571 | |
2572 | /* | | 2572 | /* |
2573 | * Fill in a proc structure for the specified process. | | 2573 | * Fill in a proc structure for the specified process. |
2574 | */ | | 2574 | */ |
2575 | static void | | 2575 | static void |
2576 | fill_proc(const struct proc *psrc, struct proc *p, bool allowaddr) | | 2576 | fill_proc(const struct proc *psrc, struct proc *p, bool allowaddr) |
2577 | { | | 2577 | { |
2578 | COND_SET_STRUCT(p->p_list, psrc->p_list, allowaddr); | | 2578 | COND_SET_STRUCT(p->p_list, psrc->p_list, allowaddr); |
2579 | memset(&p->p_auxlock, 0, allowaddr); | | 2579 | memset(&p->p_auxlock, 0, sizeof(p->p_auxlock)); |
2580 | COND_SET_STRUCT(p->p_lock, psrc->p_lock, allowaddr); | | 2580 | COND_SET_STRUCT(p->p_lock, psrc->p_lock, allowaddr); |
2581 | memset(&p->p_stmutex, 0, allowaddr); | | 2581 | memset(&p->p_stmutex, 0, sizeof(p->p_stmutex)); |
2582 | memset(&p->p_reflock, 0, allowaddr); | | 2582 | memset(&p->p_reflock, 0, sizeof(p->p_reflock)); |
2583 | COND_SET_STRUCT(p->p_waitcv, psrc->p_waitcv, allowaddr); | | 2583 | COND_SET_STRUCT(p->p_waitcv, psrc->p_waitcv, allowaddr); |
2584 | COND_SET_STRUCT(p->p_lwpcv, psrc->p_lwpcv, allowaddr); | | 2584 | COND_SET_STRUCT(p->p_lwpcv, psrc->p_lwpcv, allowaddr); |
2585 | COND_SET_PTR(p->p_cred, psrc->p_cred, allowaddr); | | 2585 | COND_SET_PTR(p->p_cred, psrc->p_cred, allowaddr); |
2586 | COND_SET_PTR(p->p_fd, psrc->p_fd, allowaddr); | | 2586 | COND_SET_PTR(p->p_fd, psrc->p_fd, allowaddr); |
2587 | COND_SET_PTR(p->p_cwdi, psrc->p_cwdi, allowaddr); | | 2587 | COND_SET_PTR(p->p_cwdi, psrc->p_cwdi, allowaddr); |
2588 | COND_SET_PTR(p->p_stats, psrc->p_stats, allowaddr); | | 2588 | COND_SET_PTR(p->p_stats, psrc->p_stats, allowaddr); |
2589 | COND_SET_PTR(p->p_limit, psrc->p_limit, allowaddr); | | 2589 | COND_SET_PTR(p->p_limit, psrc->p_limit, allowaddr); |
2590 | COND_SET_PTR(p->p_vmspace, psrc->p_vmspace, allowaddr); | | 2590 | COND_SET_PTR(p->p_vmspace, psrc->p_vmspace, allowaddr); |
2591 | COND_SET_PTR(p->p_sigacts, psrc->p_sigacts, allowaddr); | | 2591 | COND_SET_PTR(p->p_sigacts, psrc->p_sigacts, allowaddr); |
2592 | COND_SET_PTR(p->p_aio, psrc->p_aio, allowaddr); | | 2592 | COND_SET_PTR(p->p_aio, psrc->p_aio, allowaddr); |
2593 | p->p_mqueue_cnt = psrc->p_mqueue_cnt; | | 2593 | p->p_mqueue_cnt = psrc->p_mqueue_cnt; |
2594 | memset(&p->p_specdataref, 0, allowaddr); | | 2594 | memset(&p->p_specdataref, 0, sizeof(p->p_specdataref)); |
2595 | p->p_exitsig = psrc->p_exitsig; | | 2595 | p->p_exitsig = psrc->p_exitsig; |
2596 | p->p_flag = psrc->p_flag; | | 2596 | p->p_flag = psrc->p_flag; |
2597 | p->p_sflag = psrc->p_sflag; | | 2597 | p->p_sflag = psrc->p_sflag; |
2598 | p->p_slflag = psrc->p_slflag; | | 2598 | p->p_slflag = psrc->p_slflag; |
2599 | p->p_lflag = psrc->p_lflag; | | 2599 | p->p_lflag = psrc->p_lflag; |
2600 | p->p_stflag = psrc->p_stflag; | | 2600 | p->p_stflag = psrc->p_stflag; |
2601 | p->p_stat = psrc->p_stat; | | 2601 | p->p_stat = psrc->p_stat; |
2602 | p->p_trace_enabled = psrc->p_trace_enabled; | | 2602 | p->p_trace_enabled = psrc->p_trace_enabled; |
2603 | p->p_pid = psrc->p_pid; | | 2603 | p->p_pid = psrc->p_pid; |
2604 | COND_SET_STRUCT(p->p_pglist, psrc->p_pglist, allowaddr); | | 2604 | COND_SET_STRUCT(p->p_pglist, psrc->p_pglist, allowaddr); |
2605 | COND_SET_PTR(p->p_pptr, psrc->p_pptr, allowaddr); | | 2605 | COND_SET_PTR(p->p_pptr, psrc->p_pptr, allowaddr); |
2606 | COND_SET_STRUCT(p->p_sibling, psrc->p_sibling, allowaddr); | | 2606 | COND_SET_STRUCT(p->p_sibling, psrc->p_sibling, allowaddr); |
2607 | COND_SET_STRUCT(p->p_children, psrc->p_children, allowaddr); | | 2607 | COND_SET_STRUCT(p->p_children, psrc->p_children, allowaddr); |