2

I would like to know if it is poosible to change the virtual address space of a child process in Unix like operating system. I want to have the ability to

(a) Load/unload shared libraries

(b) Write to random user space memory locations of the child process ( not shared memory)

I basically want complete control (think windows 95 like control) over the process address space of a child process.

I know debuggers achieve this to a certain extent, but do you achieve this (system calls to be used, tutorials about subject,etc)??

Michał Politowski
  • 4,288
  • 3
  • 30
  • 41
qwrty
  • 331
  • 3
  • 15

1 Answers1

2

You need to look into ptrace.

 ptrace() provides tracing and debugging facilities.  It allows one
 process (the tracing process) to control another (the traced process).

You can use PTRACE_ATTACH to start tracing, PTRACE_GETREGS (SETREGS) to get/set registers, PTRACE_PEEKUSER (POKEUSER) to read/write user data and PTRACE_PEEKDATA (POKEDATA) to read/write data/code sections.

perreal
  • 94,503
  • 21
  • 155
  • 181