mmap /proc/<pid>/mem ... alternatives?
I have a black-box process (of which I can disassemble enough to insert debugging traps). I need to read a large number of sparse structures that are a few bytes to a few hundred kbyte each. In Linux 2.2, I was simply mmap()ing the process's memory, but that feature seems removed in Linux 2.4, so.. I need alternatives..
Here's a list of things I'm considering:
provide mmap() patch for /proc/<pid>/mem
Definitely out of my league :)
mmap() of /dev/mem
needs root (I can live with that)
need to know where the process's memory is --
I don't know how to determine this.
shared memory
need to bootstrap some code at the beginning (doable)
I don't know how to re-map the data, bss, and stack to
shared memory properly.
use read/write on /proc/<pid>/mem
write() doesn't work (doesn't write to the process).
complicates the code in my program quite a bit.
hybrid read, ptrace(PTRACE_POKEDATA, ...)
works, but I would like to avoid all the extra copies,
and this complicates the code quite a bit.
downgrade to 2.2
Only as an absolute last resort, if nothing else works.
Signature · 1 line
Zinx Verituse