lkml.org 
[lkml]   [2011]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/1] x86: Add process memory layout to coredump file
From
On 12/11/11, Andi Kleen <andi@firstfloor.org> wrote:
> t cheney <cdmalord@gmail.com> writes:
>
>> This patch just add memory layout(same as /proc/pid/maps) to
>> coredump file. The layout is appended to corenote segment with
>> flag NT_MAPS=7.
>
> Seems like a reasonable idea, but can you please share code with
> the proc implementation?
Yes, I will post it in following mail.
>
> It's a bit unusal to have ASCII in a coredump, but I suppose expressing
> this in binary would be somewhat ugly.
>
>> + char *buf = notes->data;
>> + size_t core_limit = notes->datasz;
>> + gate_vma = get_gate_vma(current->mm);
>> +
The maps info is appended to core notes segment in which there are all
ASCII text such as regs,signal and thread info.
>
> It seems a bit dubious to do this without locking even in a core dump.
>
>> + for (vma = first_vma(current, gate_vma); vma != NULL;
>> + vma = next_vma(vma, gate_vma)) {
>> + flags = vma->vm_flags;
>> + maps_size += len;
>> + if (file) {
>> + if (maps_size > core_limit)
>> + break;
>
> You have a one-off bug here. Also below.
>
>> + DUMP_WRITE(buf, len, foffset);
>> + }
>
Because proceses that could change vma pages are blocked in do_exit,
here vma pages are safe.
>
> -Andi
> --
> ak@linux.intel.com -- Speaking for myself only
>


\
 
 \ /
  Last update: 2011-12-11 13:47    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog