Re: [PATCH 6/7] proc: Introduce the /proc/<pid>/dump file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Sat, Jul 23, 2011 at 12:49:22PM +0400, Pavel Emelyanov wrote:
> On 07/23/2011 12:37 PM, Tejun Heo wrote:
> > Just use ptrace.  Seizing all threads in a process, gather file and
> > memory map info from /proc, inject a parasite to dump memory pages and
> > do whatever else.  There's nothing special about TLS, fs/gs base is
> > already included in ptrace register dump in x86_64.  Dunno how it's
> > handled in 32bit but if it's not available exporting it isn't a big
> > deal.  Rebuilding the process image from the captured information
> > shouldn't be too hard.
> 
> You're talking about your recent set for ptrace? Can you propose a
> quick scratch of how you propose to dump and restore registers and
> memory with this?

Hmmm... I thought I just did that writing the above paragraph, so even
without the parasite treak, ptrace has access to full memory space and
registers of the tracee, so the basic stuff is already dumpable &&
restorable - at its simplest, dumper can PEEKDATA for each mapped
memory area (as indicated by /proc/PID/maps), use GETREGS and
GETFPREGS to acquire register states, save them.  To restore, launch a
process, attach to it, let it mmap all the recorded areas and fill it
from the saved data and SETREGS/SETFPREGS to restore the register
states and let go.

This of course is over-simplified but this should work.  There are
some missing things like finding out which signals are pending and
with what siginfo but those can be solved with small additions to
/proc.

Thanks.

-- 
tejun
_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers


[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux