aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_elf.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-10-05 18:08:47 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-11-09 00:16:24 -0500
commit13046ece9625f96fafb0cff0b9b95a586b53b553 (patch)
treef1bbd3d6a4478148a45d9a0f867aae2b777eb380 /fs/binfmt_elf.c
parentaa3e7eaf0a0f06edd2b733e84e7e8ffe108e8786 (diff)
binfmt_elf: convert writing actual dump pages to dump_emit()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r--fs/binfmt_elf.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index a998b221b53a..ddab40d3d828 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -2093,7 +2093,6 @@ static int elf_core_dump(struct coredump_params *cprm)
2093 2093
2094 offset += sizeof(*elf); /* Elf header */ 2094 offset += sizeof(*elf); /* Elf header */
2095 offset += segs * sizeof(struct elf_phdr); /* Program headers */ 2095 offset += segs * sizeof(struct elf_phdr); /* Program headers */
2096 foffset = offset;
2097 2096
2098 /* Write notes phdr entry */ 2097 /* Write notes phdr entry */
2099 { 2098 {
@@ -2157,7 +2156,6 @@ static int elf_core_dump(struct coredump_params *cprm)
2157 goto end_coredump; 2156 goto end_coredump;
2158 2157
2159 size = cprm->written; 2158 size = cprm->written;
2160 cprm->written = foffset; /* will disappear */
2161 /* write out the notes section */ 2159 /* write out the notes section */
2162 if (!write_note_info(&info, cprm)) 2160 if (!write_note_info(&info, cprm))
2163 goto end_coredump; 2161 goto end_coredump;
@@ -2170,6 +2168,7 @@ static int elf_core_dump(struct coredump_params *cprm)
2170 if (!dump_seek(cprm->file, dataoff - foffset)) 2168 if (!dump_seek(cprm->file, dataoff - foffset))
2171 goto end_coredump; 2169 goto end_coredump;
2172 2170
2171 cprm->written = size;
2173 for (vma = first_vma(current, gate_vma); vma != NULL; 2172 for (vma = first_vma(current, gate_vma); vma != NULL;
2174 vma = next_vma(vma, gate_vma)) { 2173 vma = next_vma(vma, gate_vma)) {
2175 unsigned long addr; 2174 unsigned long addr;
@@ -2184,9 +2183,7 @@ static int elf_core_dump(struct coredump_params *cprm)
2184 page = get_dump_page(addr); 2183 page = get_dump_page(addr);
2185 if (page) { 2184 if (page) {
2186 void *kaddr = kmap(page); 2185 void *kaddr = kmap(page);
2187 stop = ((size += PAGE_SIZE) > cprm->limit) || 2186 stop = !dump_emit(cprm, kaddr, PAGE_SIZE);
2188 !dump_write(cprm->file, kaddr,
2189 PAGE_SIZE);
2190 kunmap(page); 2187 kunmap(page);
2191 page_cache_release(page); 2188 page_cache_release(page);
2192 } else 2189 } else
@@ -2196,16 +2193,11 @@ static int elf_core_dump(struct coredump_params *cprm)
2196 } 2193 }
2197 } 2194 }
2198 2195
2199 cprm->written = size;
2200 if (!elf_core_write_extra_data(cprm)) 2196 if (!elf_core_write_extra_data(cprm))
2201 goto end_coredump; 2197 goto end_coredump;
2202 size = cprm->written;
2203 2198
2204 if (e_phnum == PN_XNUM) { 2199 if (e_phnum == PN_XNUM) {
2205 size += sizeof(*shdr4extnum); 2200 if (!dump_emit(cprm, shdr4extnum, sizeof(*shdr4extnum)))
2206 if (size > cprm->limit
2207 || !dump_write(cprm->file, shdr4extnum,
2208 sizeof(*shdr4extnum)))
2209 goto end_coredump; 2201 goto end_coredump;
2210 } 2202 }
2211 2203