| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: netbsd32_mod.c,v 1.13.16.14 2018/09/23 11:23:47 pgoyette Exp $ */ | | 1 | /* $NetBSD: netbsd32_mod.c,v 1.13.16.15 2018/09/23 11:29:53 pgoyette Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software developed for The NetBSD Foundation | | 7 | * This code is derived from software developed for The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -20,51 +20,50 @@ | | | @@ -20,51 +20,50 @@ |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.13.16.14 2018/09/23 11:23:47 pgoyette Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.13.16.15 2018/09/23 11:29:53 pgoyette Exp $"); |
34 | | | 34 | |
35 | #ifdef _KERNEL_OPT | | 35 | #ifdef _KERNEL_OPT |
36 | #include "opt_execfmt.h" | | 36 | #include "opt_execfmt.h" |
37 | #endif | | 37 | #endif |
38 | | | 38 | |
39 | #ifndef ELFSIZE | | 39 | #ifndef ELFSIZE |
40 | #define ELFSIZE ARCH_ELFSIZE | | 40 | #define ELFSIZE ARCH_ELFSIZE |
41 | #endif | | 41 | #endif |
42 | | | 42 | |
43 | #include <sys/param.h> | | 43 | #include <sys/param.h> |
44 | #include <sys/module.h> | | 44 | #include <sys/module.h> |
45 | #include <sys/exec.h> | | 45 | #include <sys/exec.h> |
46 | #include <sys/exec_elf.h> | | 46 | #include <sys/exec_elf.h> |
47 | #include <sys/module_hook.h> | | 47 | #include <sys/module_hook.h> |
48 | | | 48 | |
49 | #include <compat/netbsd32/netbsd32_sysctl.h> | | 49 | #include <compat/netbsd32/netbsd32_sysctl.h> |
50 | #include <compat/netbsd32/netbsd32_kern_proc.h> | | 50 | #include <compat/netbsd32/netbsd32_kern_proc.h> |
51 | #include <compat/netbsd32/netbsd32_exec.h> | | 51 | #include <compat/netbsd32/netbsd32_exec.h> |
52 | | | 52 | |
53 | #define ELF32_AUXSIZE (howmany(ELF_AUX_ENTRIES * sizeof(Aux32Info), \ | | 53 | #define ELF32_AUXSIZE (howmany(ELF_AUX_ENTRIES * sizeof(Aux32Info), \ |
54 | sizeof(Elf32_Addr)) + MAXPATHLEN + ALIGN(1)) | | 54 | sizeof(Elf32_Addr)) + MAXPATHLEN + ALIGN(1)) |
55 | | | 55 | |
56 | struct compat32_80_modctl_hook_t compat32_80_modctl_hook; | | 56 | struct compat32_80_modctl_hook_t compat32_80_modctl_hook; |
57 | struct kern_proc_32_hook_t kern_proc_32_hook; | | | |
58 | | | 57 | |
59 | # define DEPS1 "ksem,coredump,compat_util" | | 58 | # define DEPS1 "ksem,coredump,compat_util" |
60 | | | 59 | |
61 | #if defined(EXEC_ELF32) | | 60 | #if defined(EXEC_ELF32) |
62 | # define DEPS2 ",exec_elf32" | | 61 | # define DEPS2 ",exec_elf32" |
63 | #else | | 62 | #else |
64 | # define DEPS2 "" | | 63 | # define DEPS2 "" |
65 | #endif | | 64 | #endif |
66 | | | 65 | |
67 | MODULE(MODULE_CLASS_EXEC, compat_netbsd32, DEPS1 DEPS2); | | 66 | MODULE(MODULE_CLASS_EXEC, compat_netbsd32, DEPS1 DEPS2); |
68 | | | 67 | |
69 | static struct execsw netbsd32_execsw[] = { | | 68 | static struct execsw netbsd32_execsw[] = { |
70 | #ifdef EXEC_AOUT | | 69 | #ifdef EXEC_AOUT |