From 4803918ba5498fe58a9b093553298df1d5365e4e Mon Sep 17 00:00:00 2001 From: HATAYAMA Daisuke Date: Wed, 3 Jul 2013 10:19:11 +1000 Subject: vmcore: disable mmap_vmcore() if CONFIG_MMU is not defined From Arnd's report of a link-time build error in vmcore.c, it turned out that mmap_vmcore() work overlooked no-MMU configuraiton. In the current design, it's impossible to implement mmap_vmcore() for no-MMU configuration since MMU is essential in order to map physically non-contiguous objects (ELF header, ELF note segment and memory regions in the 1st kernel pointed to by PT_LOAD entries) into virtually contiguous user-space in ELF layout. Hence, this patch disables mmap_vmcore() if CONFIG_MMU is not defined, returning -ENOSYS. Another change is to fix the build error by using vmalloc_user() instead of calling vzalloc() and find_vm_area() in order, by which we no longer need to call find_vm_area() in vmcore.c that has no counterpart on non-MMU configuration. Also, on no-MMU configuration, because we don't export buffer for ELF note segment to user-space, we use vzalloc() to allocate the buffer. Therefore, we use differnet functions to allocate the buffer for ELF note segment. To avoid code duplication, introduce a helper alloc_elfnotes_buf(). Signed-off-by: HATAYAMA Daisuke Reported-by: Arnd Bergmann Cc: Atsushi Kumagai Cc: HATAYAMA Daisuke Cc: KOSAKI Motohiro Cc: Lisa Mitchell Cc: Vivek Goyal Cc: Zhang Yanfei Signed-off-by: Andrew Morton --- fs/proc/vmcore.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'fs') diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 62da5eeb3102..28503172f2e4 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -462,7 +462,6 @@ 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; @@ -479,14 +478,6 @@ 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; @@ -650,7 +641,6 @@ 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; @@ -667,14 +657,6 @@ 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; -- cgit v1.2.3