Skip to content

Commit

Permalink
vmcore: allow user process to remap ELF note segment buffer
Browse files Browse the repository at this point in the history
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.

[[email protected]: use the conventional comment layout]
Signed-off-by: HATAYAMA Daisuke <[email protected]>
Acked-by: Vivek Goyal <[email protected]>
Cc: KOSAKI Motohiro <[email protected]>
Cc: Atsushi Kumagai <[email protected]>
Cc: Lisa Mitchell <[email protected]>
Cc: Zhang Yanfei <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
HATAYAMA Daisuke authored and torvalds committed Jul 3, 2013
1 parent 087350c commit ef9e78f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions fs/proc/vmcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -385,6 +386,14 @@ 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;
Expand Down Expand Up @@ -548,6 +557,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;

Expand All @@ -564,6 +574,14 @@ 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;
Expand Down

0 comments on commit ef9e78f

Please sign in to comment.