Reading living process memory without interrupting it

后端 未结 5 1243
独厮守ぢ
独厮守ぢ 2020-12-04 14:41

I would like to explore the memory of a living process, and when I do so, the process must not get disturbed - so attaching gdb to the process (which would stop it) is not a

5条回答
  •  离开以前
    2020-12-04 15:00

    Since the 3.2 version of the kernel. You can use the process_vm_readv system call to read process memory without interruption.

    ssize_t process_vm_readv(pid_t pid,
                                    const struct iovec *local_iov,
                                    unsigned long liovcnt,
                                    const struct iovec *remote_iov,
                                    unsigned long riovcnt,
                                    unsigned long flags);
    

    These system calls transfer data between the address space of the calling process ("the local process") and the process identified by pid ("the remote process"). The data moves directly between the address spaces of the two processes, without passing through kernel space.

提交回复
热议问题