Re: Kernel memory

From: Gilles Pokam
Date: Fri Apr 29 2005 - 00:35:34 EST


On 4/28/05, Chris Wedgwood <cw@xxxxxxxx> wrote:
> On Thu, Apr 28, 2005 at 04:52:21PM -0700, Gilles Pokam wrote:
>
> > I have a special user application who needs to access any part of
> > the kernel memory.
>
> why & for what?
>
> > My question is therefore how to make the whole memory accessible for
> > that particular application ?
>
> maybe /dev/kmem or /proc/kcore
>
> it would help if you explain in more detail what you are trying to do
>

Here is the big picture of the what (detailed are omitted):
I'm experimenting with system to help developers debug their programs.
The debugger is based on a replayer whose purpose is to
deterministically replay the last millions of instructions that lead
to a crash. On the user site, when the program runs, a trace of load
values along with some architectural state is continuously recorded.
Upon a crash, this trace is sent to the developer for debugging. At
the developer site, the application is replayed as follows. The
architectural state is initialized by reading the values from the
trace. The execution then proceeds as follows. If a load instruction
is encountered, the value is taken from the trace. Otherwise all other
instructions execute normally.

Issues:
Now, there are cases where a load value read from the trace (a virtual
address) raises a pagefault exception at the execution because the
address is invalid (the OS has not mapped this address) or the
accessed page doesn't have the right protection. In such cases,
instead of having the program to segfault, I want to handle this as a
valid pagefault, returning a page at the place. One other constraint
is that the application that is being debugged must not be modified.

I was thinking of making the whole memory accessible to handle this.
But I can not rely on mapping /dev/mem or /proc/kcore into the user
space since this would require modifying the binary. Are there other
ways of doing this ? May be disabling paging ? if so, how to do this ?


Thanks for any suggestions.

Gilles
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/