aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r--fs/binfmt_elf.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index d15ea1790bfb..edd90c49003c 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -44,8 +44,8 @@ static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *,
44 * If we don't support core dumping, then supply a NULL so we 44 * If we don't support core dumping, then supply a NULL so we
45 * don't even try. 45 * don't even try.
46 */ 46 */
47#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE) 47#ifdef CONFIG_ELF_CORE
48static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit); 48static int elf_core_dump(struct coredump_params *cprm);
49#else 49#else
50#define elf_core_dump NULL 50#define elf_core_dump NULL
51#endif 51#endif
@@ -1101,12 +1101,7 @@ out:
1101 return error; 1101 return error;
1102} 1102}
1103 1103
1104/* 1104#ifdef CONFIG_ELF_CORE
1105 * Note that some platforms still use traditional core dumps and not
1106 * the ELF core dump. Each platform can select it as appropriate.
1107 */
1108#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE)
1109
1110/* 1105/*
1111 * ELF core dumper 1106 * ELF core dumper
1112 * 1107 *
@@ -1277,8 +1272,9 @@ static int writenote(struct memelfnote *men, struct file *file,
1277} 1272}
1278#undef DUMP_WRITE 1273#undef DUMP_WRITE
1279 1274
1280#define DUMP_WRITE(addr, nr) \ 1275#define DUMP_WRITE(addr, nr) \
1281 if ((size += (nr)) > limit || !dump_write(file, (addr), (nr))) \ 1276 if ((size += (nr)) > cprm->limit || \
1277 !dump_write(cprm->file, (addr), (nr))) \
1282 goto end_coredump; 1278 goto end_coredump;
1283 1279
1284static void fill_elf_header(struct elfhdr *elf, int segs, 1280static void fill_elf_header(struct elfhdr *elf, int segs,
@@ -1906,7 +1902,7 @@ static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma,
1906 * and then they are actually written out. If we run out of core limit 1902 * and then they are actually written out. If we run out of core limit
1907 * we just truncate. 1903 * we just truncate.
1908 */ 1904 */
1909static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit) 1905static int elf_core_dump(struct coredump_params *cprm)
1910{ 1906{
1911 int has_dumped = 0; 1907 int has_dumped = 0;
1912 mm_segment_t fs; 1908 mm_segment_t fs;
@@ -1952,7 +1948,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
1952 * notes. This also sets up the file header. 1948 * notes. This also sets up the file header.
1953 */ 1949 */
1954 if (!fill_note_info(elf, segs + 1, /* including notes section */ 1950 if (!fill_note_info(elf, segs + 1, /* including notes section */
1955 &info, signr, regs)) 1951 &info, cprm->signr, cprm->regs))
1956 goto cleanup; 1952 goto cleanup;
1957 1953
1958 has_dumped = 1; 1954 has_dumped = 1;
@@ -2014,14 +2010,14 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
2014#endif 2010#endif
2015 2011
2016 /* write out the notes section */ 2012 /* write out the notes section */
2017 if (!write_note_info(&info, file, &foffset)) 2013 if (!write_note_info(&info, cprm->file, &foffset))
2018 goto end_coredump; 2014 goto end_coredump;
2019 2015
2020 if (elf_coredump_extra_notes_write(file, &foffset)) 2016 if (elf_coredump_extra_notes_write(cprm->file, &foffset))
2021 goto end_coredump; 2017 goto end_coredump;
2022 2018
2023 /* Align to page */ 2019 /* Align to page */
2024 if (!dump_seek(file, dataoff - foffset)) 2020 if (!dump_seek(cprm->file, dataoff - foffset))
2025 goto end_coredump; 2021 goto end_coredump;
2026 2022
2027 for (vma = first_vma(current, gate_vma); vma != NULL; 2023 for (vma = first_vma(current, gate_vma); vma != NULL;
@@ -2038,12 +2034,13 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
2038 page = get_dump_page(addr); 2034 page = get_dump_page(addr);
2039 if (page) { 2035 if (page) {
2040 void *kaddr = kmap(page); 2036 void *kaddr = kmap(page);
2041 stop = ((size += PAGE_SIZE) > limit) || 2037 stop = ((size += PAGE_SIZE) > cprm->limit) ||
2042 !dump_write(file, kaddr, PAGE_SIZE); 2038 !dump_write(cprm->file, kaddr,
2039 PAGE_SIZE);
2043 kunmap(page); 2040 kunmap(page);
2044 page_cache_release(page); 2041 page_cache_release(page);
2045 } else 2042 } else
2046 stop = !dump_seek(file, PAGE_SIZE); 2043 stop = !dump_seek(cprm->file, PAGE_SIZE);
2047 if (stop) 2044 if (stop)
2048 goto end_coredump; 2045 goto end_coredump;
2049 } 2046 }
@@ -2063,7 +2060,7 @@ out:
2063 return has_dumped; 2060 return has_dumped;
2064} 2061}
2065 2062
2066#endif /* USE_ELF_CORE_DUMP */ 2063#endif /* CONFIG_ELF_CORE */
2067 2064
2068static int __init init_elf_binfmt(void) 2065static int __init init_elf_binfmt(void)
2069{ 2066{