diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-05 17:50:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-11-09 00:16:23 -0500 |
commit | aa3e7eaf0a0f06edd2b733e84e7e8ffe108e8786 (patch) | |
tree | a4adeb88d0b1ae710a4113e55db7064895a3e70d | |
parent | 506f21c556c747bb07b893f146220ec45cda381b (diff) |
switch elf_core_write_extra_data() to dump_emit()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | arch/ia64/kernel/elfcore.c | 6 | ||||
-rw-r--r-- | arch/x86/um/elfcore.c | 8 | ||||
-rw-r--r-- | fs/binfmt_elf.c | 4 | ||||
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 4 | ||||
-rw-r--r-- | include/linux/elfcore.h | 2 |
5 files changed, 11 insertions, 13 deletions
diff --git a/arch/ia64/kernel/elfcore.c b/arch/ia64/kernel/elfcore.c index 798ce543da4b..04bc8fd5f893 100644 --- a/arch/ia64/kernel/elfcore.c +++ b/arch/ia64/kernel/elfcore.c | |||
@@ -40,8 +40,7 @@ int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset) | |||
40 | return 1; | 40 | return 1; |
41 | } | 41 | } |
42 | 42 | ||
43 | int elf_core_write_extra_data(struct file *file, size_t *size, | 43 | int elf_core_write_extra_data(struct coredump_params *cprm) |
44 | unsigned long limit) | ||
45 | { | 44 | { |
46 | const struct elf_phdr *const gate_phdrs = | 45 | const struct elf_phdr *const gate_phdrs = |
47 | (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); | 46 | (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); |
@@ -52,8 +51,7 @@ int elf_core_write_extra_data(struct file *file, size_t *size, | |||
52 | void *addr = (void *)gate_phdrs[i].p_vaddr; | 51 | void *addr = (void *)gate_phdrs[i].p_vaddr; |
53 | size_t memsz = PAGE_ALIGN(gate_phdrs[i].p_memsz); | 52 | size_t memsz = PAGE_ALIGN(gate_phdrs[i].p_memsz); |
54 | 53 | ||
55 | *size += memsz; | 54 | if (!dump_emit(cprm, addr, memsz)) |
56 | if (*size > limit || !dump_write(file, addr, memsz)) | ||
57 | return 0; | 55 | return 0; |
58 | break; | 56 | break; |
59 | } | 57 | } |
diff --git a/arch/x86/um/elfcore.c b/arch/x86/um/elfcore.c index fc21f98efafe..7bb89a27a5e4 100644 --- a/arch/x86/um/elfcore.c +++ b/arch/x86/um/elfcore.c | |||
@@ -38,8 +38,7 @@ int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset) | |||
38 | return 1; | 38 | return 1; |
39 | } | 39 | } |
40 | 40 | ||
41 | int elf_core_write_extra_data(struct file *file, size_t *size, | 41 | int elf_core_write_extra_data(struct coredump_params *cprm) |
42 | unsigned long limit) | ||
43 | { | 42 | { |
44 | if ( vsyscall_ehdr ) { | 43 | if ( vsyscall_ehdr ) { |
45 | const struct elfhdr *const ehdrp = | 44 | const struct elfhdr *const ehdrp = |
@@ -52,10 +51,7 @@ int elf_core_write_extra_data(struct file *file, size_t *size, | |||
52 | if (phdrp[i].p_type == PT_LOAD) { | 51 | if (phdrp[i].p_type == PT_LOAD) { |
53 | void *addr = (void *) phdrp[i].p_vaddr; | 52 | void *addr = (void *) phdrp[i].p_vaddr; |
54 | size_t filesz = phdrp[i].p_filesz; | 53 | size_t filesz = phdrp[i].p_filesz; |
55 | 54 | if (!dump_emit(cprm, addr, filesz)) | |
56 | *size += filesz; | ||
57 | if (*size > limit | ||
58 | || !dump_write(file, addr, filesz)) | ||
59 | return 0; | 55 | return 0; |
60 | } | 56 | } |
61 | } | 57 | } |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 35c4886dae2d..a998b221b53a 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -2196,8 +2196,10 @@ static int elf_core_dump(struct coredump_params *cprm) | |||
2196 | } | 2196 | } |
2197 | } | 2197 | } |
2198 | 2198 | ||
2199 | if (!elf_core_write_extra_data(cprm->file, &size, cprm->limit)) | 2199 | cprm->written = size; |
2200 | if (!elf_core_write_extra_data(cprm)) | ||
2200 | goto end_coredump; | 2201 | goto end_coredump; |
2202 | size = cprm->written; | ||
2201 | 2203 | ||
2202 | if (e_phnum == PN_XNUM) { | 2204 | if (e_phnum == PN_XNUM) { |
2203 | size += sizeof(*shdr4extnum); | 2205 | size += sizeof(*shdr4extnum); |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 44db8b92121a..77bf7e33e706 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -1818,8 +1818,10 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) | |||
1818 | cprm->mm_flags) < 0) | 1818 | cprm->mm_flags) < 0) |
1819 | goto end_coredump; | 1819 | goto end_coredump; |
1820 | 1820 | ||
1821 | if (!elf_core_write_extra_data(cprm->file, &size, cprm->limit)) | 1821 | cprm->written = size; |
1822 | if (!elf_core_write_extra_data(cprm)) | ||
1822 | goto end_coredump; | 1823 | goto end_coredump; |
1824 | size = cprm->written; | ||
1823 | 1825 | ||
1824 | if (e_phnum == PN_XNUM) { | 1826 | if (e_phnum == PN_XNUM) { |
1825 | size += sizeof(*shdr4extnum); | 1827 | size += sizeof(*shdr4extnum); |
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index 1b92a8c40624..698d51a0eea3 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h | |||
@@ -67,7 +67,7 @@ extern Elf_Half elf_core_extra_phdrs(void); | |||
67 | extern int | 67 | extern int |
68 | elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset); | 68 | elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset); |
69 | extern int | 69 | extern int |
70 | elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit); | 70 | elf_core_write_extra_data(struct coredump_params *cprm); |
71 | extern size_t elf_core_extra_data_size(void); | 71 | extern size_t elf_core_extra_data_size(void); |
72 | 72 | ||
73 | #endif /* _LINUX_ELFCORE_H */ | 73 | #endif /* _LINUX_ELFCORE_H */ |