Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | From | HATAYAMA Daisuke <> | Subject | [PATCH 03/13] vmcore: fill unused part of buffer for ELF headers with 0 | Date | Thu, 14 Feb 2013 19:11:59 +0900 |
| |
Via mmap() we export the range [elfcorebuf_sz, roundup(elfcorebuf_sz, PAGE_SIZE)] to user-space. We need to fill this range with 0.
Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> ---
fs/proc/vmcore.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 5010ead..43d338a 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -328,6 +328,11 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz, *elfsz = *elfsz - i; memmove(tmp, tmp+i, ((*elfsz)-sizeof(Elf64_Ehdr)-sizeof(Elf64_Phdr))); + /* Fill unused part with zero */ + memset(elfptr + sizeof(Elf64_Ehdr) + + (ehdr_ptr->e_phnum - nr_ptnote + 1) * sizeof(Elf64_Phdr), 0, + (nr_ptnote - 1) * sizeof(Elf64_Phdr)); + /* Modify e_phnum to reflect merged headers. */ ehdr_ptr->e_phnum = ehdr_ptr->e_phnum - nr_ptnote + 1;
| ![\](/images/icornerr.gif) |