ptrace

Using PTRACE_POKEDATA to replace data in the heap of a process

空扰寡人 提交于 2021-02-10 09:29:26
问题 I would like to use ptrace in order to attach my tool to a Linux process, read and write to the heap memory of this process and again detach my tool. Actually, it's not working although there is no error. I can not see any modifications in the heap memory of the process after I run the tool. Anyway, I'm quite not sure if that is possible in general. Currently, my C code looks like this: int res = 0, i = 0; int size = heap_address->end - heap_address->start; char tmp_page[size]; memset(tmp

Using PTRACE_POKEDATA to replace data in the heap of a process

匆匆过客 提交于 2021-02-10 09:25:50
问题 I would like to use ptrace in order to attach my tool to a Linux process, read and write to the heap memory of this process and again detach my tool. Actually, it's not working although there is no error. I can not see any modifications in the heap memory of the process after I run the tool. Anyway, I'm quite not sure if that is possible in general. Currently, my C code looks like this: int res = 0, i = 0; int size = heap_address->end - heap_address->start; char tmp_page[size]; memset(tmp

Using PTRACE_POKEDATA to replace data in the heap of a process

試著忘記壹切 提交于 2021-02-10 09:25:28
问题 I would like to use ptrace in order to attach my tool to a Linux process, read and write to the heap memory of this process and again detach my tool. Actually, it's not working although there is no error. I can not see any modifications in the heap memory of the process after I run the tool. Anyway, I'm quite not sure if that is possible in general. Currently, my C code looks like this: int res = 0, i = 0; int size = heap_address->end - heap_address->start; char tmp_page[size]; memset(tmp

Linux ptrace() read whole memory page

假装没事ソ 提交于 2021-02-08 10:44:46
问题 Hello I try to dump the memory of a process in Android/Linux. Right now I read the memory maps to get a memory region's address space and then I read every single word like this: ptrace(PTRACE_ATTACH, pid, NULL, NULL); wait(NULL); read each word in this memory region: word = ptrace(PTRACE_PEEKDATA, pid, (void *)address, NULL); ptrace(PTRACE_CONT, pid, NULL, NULL); ptrace(PTRACE_DETACH, pid, NULL, NULL); Isn't there a more efficient solution reading directly a whole memory page by specifying

Does android support the PTRACE_SINGLESTEP?

て烟熏妆下的殇ゞ 提交于 2021-01-07 01:35:36
问题 OK, this is a simple question.Does android support the PTRACE_SINGLESTEP when I use ptrace systemcall? when I want to ptrace a android apk program, I find that I can't process the SINGLESTEP trace. But the situation changed when I use the PTRACE_SYSCALL, It can work perfectly. Does the android wipe out this function or arm lack some supports in hardware? Any help will be appreciated!thanks. this is my core program: int main(int argc, char *argv[]) { if(argc != 2) { __android_log_print(ANDROID

What instructions does qemu trace?

我怕爱的太早我们不能终老 提交于 2020-12-30 02:21:26
问题 I wrote the following piece of code that steps through /bin/ls and counts its instructions: #include <stdio.h> #include <sys/ptrace.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <sys/user.h> #include <sys/reg.h> #include <sys/syscall.h> int main() { pid_t child; child = fork(); //create child if(child == 0) { ptrace(PTRACE_TRACEME, 0, NULL, NULL); char* child_argv[] = {"/bin/ls", NULL}; execv("/bin/ls", child_argv); } else { int status; long long ins_count = 0;

Does android support the PTRACE_SINGLESTEP?

99封情书 提交于 2020-12-26 04:22:47
问题 OK, this is a simple question.Does android support the PTRACE_SINGLESTEP when I use ptrace systemcall? when I want to ptrace a android apk program, I find that I can't process the SINGLESTEP trace. But the situation changed when I use the PTRACE_SYSCALL, It can work perfectly. Does the android wipe out this function or arm lack some supports in hardware? Any help will be appreciated!thanks. this is my core program: int main(int argc, char *argv[]) { if(argc != 2) { __android_log_print(ANDROID