提交 ef9e78fd 编写于 作者: H HATAYAMA Daisuke 提交者: Linus Torvalds

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.

[akpm@linux-foundation.org: use the conventional comment layout]
Signed-off-by: NHATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Acked-by: NVivek Goyal <vgoyal@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Cc: Lisa Mitchell <lisa.mitchell@hp.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 087350c9
...@@ -369,6 +369,7 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz, ...@@ -369,6 +369,7 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz,
Elf64_Ehdr *ehdr_ptr; Elf64_Ehdr *ehdr_ptr;
Elf64_Phdr phdr; Elf64_Phdr phdr;
u64 phdr_sz = 0, note_off; u64 phdr_sz = 0, note_off;
struct vm_struct *vm;
ehdr_ptr = (Elf64_Ehdr *)elfptr; ehdr_ptr = (Elf64_Ehdr *)elfptr;
...@@ -385,6 +386,14 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz, ...@@ -385,6 +386,14 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz,
if (!*notes_buf) if (!*notes_buf)
return -ENOMEM; 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); rc = copy_notes_elf64(ehdr_ptr, *notes_buf);
if (rc < 0) if (rc < 0)
return rc; return rc;
...@@ -548,6 +557,7 @@ static int __init merge_note_headers_elf32(char *elfptr, size_t *elfsz, ...@@ -548,6 +557,7 @@ static int __init merge_note_headers_elf32(char *elfptr, size_t *elfsz,
Elf32_Ehdr *ehdr_ptr; Elf32_Ehdr *ehdr_ptr;
Elf32_Phdr phdr; Elf32_Phdr phdr;
u64 phdr_sz = 0, note_off; u64 phdr_sz = 0, note_off;
struct vm_struct *vm;
ehdr_ptr = (Elf32_Ehdr *)elfptr; ehdr_ptr = (Elf32_Ehdr *)elfptr;
...@@ -564,6 +574,14 @@ static int __init merge_note_headers_elf32(char *elfptr, size_t *elfsz, ...@@ -564,6 +574,14 @@ static int __init merge_note_headers_elf32(char *elfptr, size_t *elfsz,
if (!*notes_buf) if (!*notes_buf)
return -ENOMEM; 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); rc = copy_notes_elf32(ehdr_ptr, *notes_buf);
if (rc < 0) if (rc < 0)
return rc; return rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册