Re: About reading /proc/*/mem

Stephen C. Tweedie
2001-05-02T10:25:51Z

Hi,

On Tue, May 01, 2001 at 12:35:29PM -0400, Alexander Viro wrote:
>
> On 1 May 2001, Eric W. Biederman wrote:
>
> > > Unfortunately, ptrace() probobally isn't going to allow me to do that.
> > > So my next question is does opening /proc/*/mem force the child process
> > > to stop on every interrupt (just like ptrace?)
> >
> >
> > The not stopping the child should be the major difference between
> > /proc/*/mem and ptrace.
>
> Could somebody tell me what would one do with data read from memory
> of process that is currently running?

As long as we have the appropriate page table lock while doing the
physical page lookup, and grab a refcount on the page with the lock
held, we'll get a valid physical memory location to read to the user.
We don't need any stronger guarantee than that --- if the target
process is playing mmap games or modifying the memory while the read
happens, the result is unpredictable but safe.

Cheers,
Stephen