From: HATAYAMA Daisuke Date: Fri, 7 Jun 2013 00:07:50 +0000 (+1000) Subject: vmcore: allow user process to remap ELF note segment buffer X-Git-Tag: next-20130607~2^2~413 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3726ac37376b777a4db768e6c137fc7f3457cde2;p=karo-tx-linux.git vmcore: allow user process to remap ELF note segment buffer Now ELF note segment has been copied in the buffer on vmalloc memory. To allow user process to remap the ELF note segment buffer with remap_vmalloc_page, the corresponding VM area object has to have VM_USERMAP flag set. Signed-off-by: HATAYAMA Daisuke Acked-by: Vivek Goyal Cc: KOSAKI Motohiro Cc: Atsushi Kumagai Cc: Lisa Mitchell Cc: Zhang Yanfei Signed-off-by: Andrew Morton --- diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 9b9270eb0599..dbf91c2138cf 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -369,6 +369,7 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz, Elf64_Ehdr *ehdr_ptr; Elf64_Phdr phdr; u64 phdr_sz = 0, note_off; + struct vm_struct *vm; ehdr_ptr = (Elf64_Ehdr *)elfptr; @@ -385,6 +386,12 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz, if (!*notes_buf) return -ENOMEM; + /* Allow users to remap ELF note segment buffer on vmalloc + * memory using remap_vmalloc_range. */ + vm = find_vm_area(*notes_buf); + BUG_ON(!vm); + vm->flags |= VM_USERMAP; + rc = copy_notes_elf64(ehdr_ptr, *notes_buf); if (rc < 0) return rc; @@ -548,6 +555,7 @@ static int __init merge_note_headers_elf32(char *elfptr, size_t *elfsz, Elf32_Ehdr *ehdr_ptr; Elf32_Phdr phdr; u64 phdr_sz = 0, note_off; + struct vm_struct *vm; ehdr_ptr = (Elf32_Ehdr *)elfptr; @@ -564,6 +572,12 @@ static int __init merge_note_headers_elf32(char *elfptr, size_t *elfsz, if (!*notes_buf) return -ENOMEM; + /* Allow users to remap ELF note segment buffer on vmalloc + * memory using remap_vmalloc_range. */ + vm = find_vm_area(*notes_buf); + BUG_ON(!vm); + vm->flags |= VM_USERMAP; + rc = copy_notes_elf32(ehdr_ptr, *notes_buf); if (rc < 0) return rc;