| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: core_elf32.c,v 1.58.4.1 2021/01/01 13:04:08 martin Exp $ */ | | 1 | /* $NetBSD: core_elf32.c,v 1.58.4.2 2021/01/02 10:23:46 martin Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2001 Wasabi Systems, Inc. | | 4 | * Copyright (c) 2001 Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Jason R. Thorpe for Wasabi Systems, Inc. | | 7 | * Written by Jason R. Thorpe for Wasabi Systems, Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -30,27 +30,27 @@ | | | @@ -30,27 +30,27 @@ |
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
35 | * POSSIBILITY OF SUCH DAMAGE. | | 35 | * POSSIBILITY OF SUCH DAMAGE. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | /* | | 38 | /* |
39 | * core_elf32.c/core_elf64.c: Support for the Elf32/Elf64 core file format. | | 39 | * core_elf32.c/core_elf64.c: Support for the Elf32/Elf64 core file format. |
40 | */ | | 40 | */ |
41 | | | 41 | |
42 | #include <sys/cdefs.h> | | 42 | #include <sys/cdefs.h> |
43 | __KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.58.4.1 2021/01/01 13:04:08 martin Exp $"); | | 43 | __KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.58.4.2 2021/01/02 10:23:46 martin Exp $"); |
44 | | | 44 | |
45 | #ifdef _KERNEL_OPT | | 45 | #ifdef _KERNEL_OPT |
46 | #include "opt_coredump.h" | | 46 | #include "opt_coredump.h" |
47 | #include "opt_compat_netbsd32.h" | | 47 | #include "opt_compat_netbsd32.h" |
48 | #endif | | 48 | #endif |
49 | | | 49 | |
50 | #ifndef ELFSIZE | | 50 | #ifndef ELFSIZE |
51 | #define ELFSIZE 32 | | 51 | #define ELFSIZE 32 |
52 | #endif | | 52 | #endif |
53 | | | 53 | |
54 | #include <sys/param.h> | | 54 | #include <sys/param.h> |
55 | #include <sys/systm.h> | | 55 | #include <sys/systm.h> |
56 | #include <sys/proc.h> | | 56 | #include <sys/proc.h> |
| @@ -58,27 +58,27 @@ __KERNEL_RCSID(1, "$NetBSD: core_elf32.c | | | @@ -58,27 +58,27 @@ __KERNEL_RCSID(1, "$NetBSD: core_elf32.c |
58 | #include <sys/exec.h> | | 58 | #include <sys/exec.h> |
59 | #include <sys/exec_elf.h> | | 59 | #include <sys/exec_elf.h> |
60 | #include <sys/ptrace.h> | | 60 | #include <sys/ptrace.h> |
61 | #include <sys/kmem.h> | | 61 | #include <sys/kmem.h> |
62 | #include <sys/kauth.h> | | 62 | #include <sys/kauth.h> |
63 | | | 63 | |
64 | #include <machine/reg.h> | | 64 | #include <machine/reg.h> |
65 | | | 65 | |
66 | #include <uvm/uvm_extern.h> | | 66 | #include <uvm/uvm_extern.h> |
67 | | | 67 | |
68 | #ifdef COREDUMP | | 68 | #ifdef COREDUMP |
69 | | | 69 | |
70 | #ifdef COMPAT_NETBSD32 | | 70 | #ifdef COMPAT_NETBSD32 |
71 | #include <machine/netbsd32_machdep.h> | | 71 | #include <compat/netbsd32/netbsd32.h> |
72 | #endif | | 72 | #endif |
73 | | | 73 | |
74 | struct writesegs_state { | | 74 | struct writesegs_state { |
75 | Elf_Phdr *psections; | | 75 | Elf_Phdr *psections; |
76 | proc_t *p; | | 76 | proc_t *p; |
77 | off_t secoff; | | 77 | off_t secoff; |
78 | size_t npsections; | | 78 | size_t npsections; |
79 | }; | | 79 | }; |
80 | | | 80 | |
81 | /* | | 81 | /* |
82 | * We need to know how big the 'notes' are before we write the main header. | | 82 | * We need to know how big the 'notes' are before we write the main header. |
83 | * To avoid problems with double-processing we save the data. | | 83 | * To avoid problems with double-processing we save the data. |
84 | */ | | 84 | */ |