/[packages]/backports/8/kernel/current/SOURCES/elfcore-add-a-cprm-parameter-to-elf_core_extra_-phdrs-data_size.patch
ViewVC logotype

Contents of /backports/8/kernel/current/SOURCES/elfcore-add-a-cprm-parameter-to-elf_core_extra_-phdrs-data_size.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1932881 - (show annotations) (download)
Sat Jan 14 11:15:03 2023 UTC (15 months ago) by tmb
File size: 5305 byte(s)
- update to 6.1.6
  * drop merged patches
- add current -stable queue
- Revert "mm/compaction: fix set skip in fast_find_migrateblock"
- wifi: brcmfmac: fix regression for Broadcom PCIe wifi devices


1 From 19e183b54528f11fafeca60fc6d0821e29ff281e Mon Sep 17 00:00:00 2001
2 From: Catalin Marinas <catalin.marinas@arm.com>
3 Date: Thu, 22 Dec 2022 18:12:50 +0000
4 Subject: elfcore: Add a cprm parameter to elf_core_extra_{phdrs,data_size}
5
6 From: Catalin Marinas <catalin.marinas@arm.com>
7
8 commit 19e183b54528f11fafeca60fc6d0821e29ff281e upstream.
9
10 A subsequent fix for arm64 will use this parameter to parse the vma
11 information from the snapshot created by dump_vma_snapshot() rather than
12 traversing the vma list without the mmap_lock.
13
14 Fixes: 6dd8b1a0b6cb ("arm64: mte: Dump the MTE tags in the core file")
15 Cc: <stable@vger.kernel.org> # 5.18.x
16 Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
17 Reported-by: Seth Jenkins <sethjenkins@google.com>
18 Suggested-by: Seth Jenkins <sethjenkins@google.com>
19 Cc: Will Deacon <will@kernel.org>
20 Cc: Eric Biederman <ebiederm@xmission.com>
21 Cc: Kees Cook <keescook@chromium.org>
22 Link: https://lore.kernel.org/r/20221222181251.1345752-3-catalin.marinas@arm.com
23 Signed-off-by: Will Deacon <will@kernel.org>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 arch/arm64/kernel/elfcore.c | 4 ++--
27 arch/ia64/kernel/elfcore.c | 4 ++--
28 arch/x86/um/elfcore.c | 4 ++--
29 fs/binfmt_elf.c | 4 ++--
30 fs/binfmt_elf_fdpic.c | 4 ++--
31 include/linux/elfcore.h | 8 ++++----
32 6 files changed, 14 insertions(+), 14 deletions(-)
33
34 --- a/arch/arm64/kernel/elfcore.c
35 +++ b/arch/arm64/kernel/elfcore.c
36 @@ -75,7 +75,7 @@ static int mte_dump_tag_range(struct cor
37 return ret;
38 }
39
40 -Elf_Half elf_core_extra_phdrs(void)
41 +Elf_Half elf_core_extra_phdrs(struct coredump_params *cprm)
42 {
43 int i;
44 struct core_vma_metadata *m;
45 @@ -112,7 +112,7 @@ int elf_core_write_extra_phdrs(struct co
46 return 1;
47 }
48
49 -size_t elf_core_extra_data_size(void)
50 +size_t elf_core_extra_data_size(struct coredump_params *cprm)
51 {
52 int i;
53 struct core_vma_metadata *m;
54 --- a/arch/ia64/kernel/elfcore.c
55 +++ b/arch/ia64/kernel/elfcore.c
56 @@ -7,7 +7,7 @@
57 #include <asm/elf.h>
58
59
60 -Elf64_Half elf_core_extra_phdrs(void)
61 +Elf64_Half elf_core_extra_phdrs(struct coredump_params *cprm)
62 {
63 return GATE_EHDR->e_phnum;
64 }
65 @@ -60,7 +60,7 @@ int elf_core_write_extra_data(struct cor
66 return 1;
67 }
68
69 -size_t elf_core_extra_data_size(void)
70 +size_t elf_core_extra_data_size(struct coredump_params *cprm)
71 {
72 const struct elf_phdr *const gate_phdrs =
73 (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff);
74 --- a/arch/x86/um/elfcore.c
75 +++ b/arch/x86/um/elfcore.c
76 @@ -7,7 +7,7 @@
77 #include <asm/elf.h>
78
79
80 -Elf32_Half elf_core_extra_phdrs(void)
81 +Elf32_Half elf_core_extra_phdrs(struct coredump_params *cprm)
82 {
83 return vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0;
84 }
85 @@ -60,7 +60,7 @@ int elf_core_write_extra_data(struct cor
86 return 1;
87 }
88
89 -size_t elf_core_extra_data_size(void)
90 +size_t elf_core_extra_data_size(struct coredump_params *cprm)
91 {
92 if ( vsyscall_ehdr ) {
93 const struct elfhdr *const ehdrp =
94 --- a/fs/binfmt_elf.c
95 +++ b/fs/binfmt_elf.c
96 @@ -2209,7 +2209,7 @@ static int elf_core_dump(struct coredump
97 * The number of segs are recored into ELF header as 16bit value.
98 * Please check DEFAULT_MAX_MAP_COUNT definition when you modify here.
99 */
100 - segs = cprm->vma_count + elf_core_extra_phdrs();
101 + segs = cprm->vma_count + elf_core_extra_phdrs(cprm);
102
103 /* for notes section */
104 segs++;
105 @@ -2249,7 +2249,7 @@ static int elf_core_dump(struct coredump
106 dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);
107
108 offset += cprm->vma_data_size;
109 - offset += elf_core_extra_data_size();
110 + offset += elf_core_extra_data_size(cprm);
111 e_shoff = offset;
112
113 if (e_phnum == PN_XNUM) {
114 --- a/fs/binfmt_elf_fdpic.c
115 +++ b/fs/binfmt_elf_fdpic.c
116 @@ -1509,7 +1509,7 @@ static int elf_fdpic_core_dump(struct co
117 tmp->next = thread_list;
118 thread_list = tmp;
119
120 - segs = cprm->vma_count + elf_core_extra_phdrs();
121 + segs = cprm->vma_count + elf_core_extra_phdrs(cprm);
122
123 /* for notes section */
124 segs++;
125 @@ -1555,7 +1555,7 @@ static int elf_fdpic_core_dump(struct co
126 dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);
127
128 offset += cprm->vma_data_size;
129 - offset += elf_core_extra_data_size();
130 + offset += elf_core_extra_data_size(cprm);
131 e_shoff = offset;
132
133 if (e_phnum == PN_XNUM) {
134 --- a/include/linux/elfcore.h
135 +++ b/include/linux/elfcore.h
136 @@ -114,14 +114,14 @@ static inline int elf_core_copy_task_fpr
137 * Dumping its extra ELF program headers includes all the other information
138 * a debugger needs to easily find how the gate DSO was being used.
139 */
140 -extern Elf_Half elf_core_extra_phdrs(void);
141 +extern Elf_Half elf_core_extra_phdrs(struct coredump_params *cprm);
142 extern int
143 elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset);
144 extern int
145 elf_core_write_extra_data(struct coredump_params *cprm);
146 -extern size_t elf_core_extra_data_size(void);
147 +extern size_t elf_core_extra_data_size(struct coredump_params *cprm);
148 #else
149 -static inline Elf_Half elf_core_extra_phdrs(void)
150 +static inline Elf_Half elf_core_extra_phdrs(struct coredump_params *cprm)
151 {
152 return 0;
153 }
154 @@ -136,7 +136,7 @@ static inline int elf_core_write_extra_d
155 return 1;
156 }
157
158 -static inline size_t elf_core_extra_data_size(void)
159 +static inline size_t elf_core_extra_data_size(struct coredump_params *cprm)
160 {
161 return 0;
162 }

  ViewVC Help
Powered by ViewVC 1.1.30