Low-overhead way to access the memory space of a traced process?

后端 未结 6 1640
梦谈多话
梦谈多话 2021-01-12 13:57

I\'m looking for an efficient way to access(for both read and write operations) the memory space of my ptraced child process. The size of blocks being accessed may vary from

6条回答
  •  粉色の甜心
    2021-01-12 14:30

    If this is Linux (which the tags suggest it is), you can share the entirety of the child's address space with the parent by using clone() with the CLONE_VM flag. As the two processes share the same VM space, all modifications will be immediately visible between the two, with essentially zero overhead.

    This does mean you can't then exec() in the child; as it will replace the VM space of both processes.

提交回复
热议问题