| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: exec_subr.c,v 1.78.2.4 2023/11/28 13:00:52 martin Exp $ */ | | 1 | /* $NetBSD: exec_subr.c,v 1.78.2.5 2023/11/29 12:29:05 martin Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou | | 4 | * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.78.2.4 2023/11/28 13:00:52 martin Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.78.2.5 2023/11/29 12:29:05 martin Exp $"); |
35 | | | 35 | |
36 | #include "opt_pax.h" | | 36 | #include "opt_pax.h" |
37 | | | 37 | |
38 | #include <sys/param.h> | | 38 | #include <sys/param.h> |
39 | #include <sys/systm.h> | | 39 | #include <sys/systm.h> |
40 | #include <sys/proc.h> | | 40 | #include <sys/proc.h> |
41 | #include <sys/kmem.h> | | 41 | #include <sys/kmem.h> |
42 | #include <sys/vnode.h> | | 42 | #include <sys/vnode.h> |
43 | #include <sys/filedesc.h> | | 43 | #include <sys/filedesc.h> |
44 | #include <sys/exec.h> | | 44 | #include <sys/exec.h> |
45 | #include <sys/mman.h> | | 45 | #include <sys/mman.h> |
46 | #include <sys/resourcevar.h> | | 46 | #include <sys/resourcevar.h> |
47 | #include <sys/device.h> | | 47 | #include <sys/device.h> |
| @@ -152,27 +152,27 @@ kill_vmcmds(struct exec_vmcmd_set *evsp) | | | @@ -152,27 +152,27 @@ kill_vmcmds(struct exec_vmcmd_set *evsp) |
152 | evsp->evs_used = evsp->evs_cnt = 0; | | 152 | evsp->evs_used = evsp->evs_cnt = 0; |
153 | } | | 153 | } |
154 | | | 154 | |
155 | /* | | 155 | /* |
156 | * vmcmd_map_pagedvn(): | | 156 | * vmcmd_map_pagedvn(): |
157 | * handle vmcmd which specifies that a vnode should be mmap'd. | | 157 | * handle vmcmd which specifies that a vnode should be mmap'd. |
158 | * appropriate for handling demand-paged text and data segments. | | 158 | * appropriate for handling demand-paged text and data segments. |
159 | */ | | 159 | */ |
160 | | | 160 | |
161 | static int | | 161 | static int |
162 | vmcmd_get_prot(struct lwp *l, const struct exec_vmcmd *cmd, vm_prot_t *prot, | | 162 | vmcmd_get_prot(struct lwp *l, const struct exec_vmcmd *cmd, vm_prot_t *prot, |
163 | vm_prot_t *maxprot) | | 163 | vm_prot_t *maxprot) |
164 | { | | 164 | { |
165 | vm_prot_t extraprot = PROT_MPROTECT_EXTRACT(cmd->ev_prot); | | 165 | vm_prot_t extraprot __unused = PROT_MPROTECT_EXTRACT(cmd->ev_prot); |
166 | | | 166 | |
167 | *prot = cmd->ev_prot & UVM_PROT_ALL; | | 167 | *prot = cmd->ev_prot & UVM_PROT_ALL; |
168 | *maxprot = PAX_MPROTECT_MAXPROTECT(l, *prot, extraprot, UVM_PROT_ALL); | | 168 | *maxprot = PAX_MPROTECT_MAXPROTECT(l, *prot, extraprot, UVM_PROT_ALL); |
169 | | | 169 | |
170 | if ((*prot & *maxprot) != *prot) | | 170 | if ((*prot & *maxprot) != *prot) |
171 | return EACCES; | | 171 | return EACCES; |
172 | return PAX_MPROTECT_VALIDATE(l, *prot); | | 172 | return PAX_MPROTECT_VALIDATE(l, *prot); |
173 | } | | 173 | } |
174 | | | 174 | |
175 | int | | 175 | int |
176 | vmcmd_map_pagedvn(struct lwp *l, struct exec_vmcmd *cmd) | | 176 | vmcmd_map_pagedvn(struct lwp *l, struct exec_vmcmd *cmd) |
177 | { | | 177 | { |
178 | struct uvm_object *uobj; | | 178 | struct uvm_object *uobj; |