jjzjj

PTRACE_SINGLESTEP

全部标签

c - 为什么这个 ptrace 程序说系统调用返回了 -38?

与thisone相同除了我正在运行execl("/bin/ls","ls",NULL);。结果显然是错误的,因为每个系统调用都返回-38:[user@test]#./test_tracesyscall59calledwithrdi(0),rsi(0),rdx(0)syscall12returnedwith-38syscall12calledwithrdi(0),rsi(0),rdx(140737288485480)syscall9returnedwith-38syscall9calledwithrdi(0),rsi(4096),rdx(3)syscall9returnedwith-38

c - 为什么这个 ptrace 程序说系统调用返回了 -38?

与thisone相同除了我正在运行execl("/bin/ls","ls",NULL);。结果显然是错误的,因为每个系统调用都返回-38:[user@test]#./test_tracesyscall59calledwithrdi(0),rsi(0),rdx(0)syscall12returnedwith-38syscall12calledwithrdi(0),rsi(0),rdx(140737288485480)syscall9returnedwith-38syscall9calledwithrdi(0),rsi(4096),rdx(3)syscall9returnedwith-38

在 ptraced Linux 进程中调用 ptrace

有人添加到Wikipedia"ptrace"article声称在Linux上,一个ptraced进程本身不能ptrace另一个进程。我正在尝试确定是否(如果是,为什么)是这种情况。下面是我设计的一个简单程序来测试它。我的程序失败(sub子进程未正常运行)但我非常确信这是我的错误,而不是根本性的错误。本质上,初始进程Afork进程B,后者又forkC。A追踪它的childB,B追踪它的childC。设置完成后,所有三个进程都被编写为仅每秒打印一次A、B或C到标准输出。在实践中,A和B工作正常,但C只打印一次,然后就卡住了。使用ps-eopid,cmd,wchan检查显示C卡在内核函数pt

在 ptraced Linux 进程中调用 ptrace

有人添加到Wikipedia"ptrace"article声称在Linux上,一个ptraced进程本身不能ptrace另一个进程。我正在尝试确定是否(如果是,为什么)是这种情况。下面是我设计的一个简单程序来测试它。我的程序失败(sub子进程未正常运行)但我非常确信这是我的错误,而不是根本性的错误。本质上,初始进程Afork进程B,后者又forkC。A追踪它的childB,B追踪它的childC。设置完成后,所有三个进程都被编写为仅每秒打印一次A、B或C到标准输出。在实践中,A和B工作正常,但C只打印一次,然后就卡住了。使用ps-eopid,cmd,wchan检查显示C卡在内核函数pt

c - 不允许 PTRACE_ATTACH

出于某种原因,我无法附加到我自己的进程?!如果我以root身份尝试strace就可以正常工作。$./list8&[1]3141$child4starts...$strace-p3141attach:ptrace(PTRACE_ATTACH,...):OperationnotpermittedCouldnotattachtoprocess.Ifyouruidmatchestheuidofthetargetprocess,checkthesettingof/proc/sys/kernel/yama/ptrace_scope,ortryagainastherootuser.Formorede

c - 不允许 PTRACE_ATTACH

出于某种原因,我无法附加到我自己的进程?!如果我以root身份尝试strace就可以正常工作。$./list8&[1]3141$child4starts...$strace-p3141attach:ptrace(PTRACE_ATTACH,...):OperationnotpermittedCouldnotattachtoprocess.Ifyouruidmatchestheuidofthetargetprocess,checkthesettingof/proc/sys/kernel/yama/ptrace_scope,ortryagainastherootuser.Formorede

linux - PTrace: linux/user.h: 没有那个文件或目录

我在英特尔32位机器上使用Ubuntu12.04和linux-headers-3.2.0-60。我正在尝试构建这个简单的程序来理解PTrace.但是在编译过程中出错。#include#include#include#include#include/*ForconstantsORIG_EAXetc*/intmain(){pid_tchild;longorig_eax;child=fork();if(child==0){ptrace(PTRACE_TRACEME,0,NULL,NULL);execl("/bin/ls","ls",NULL);}else{wait(NULL);orig_ea

linux - PTrace: linux/user.h: 没有那个文件或目录

我在英特尔32位机器上使用Ubuntu12.04和linux-headers-3.2.0-60。我正在尝试构建这个简单的程序来理解PTrace.但是在编译过程中出错。#include#include#include#include#include/*ForconstantsORIG_EAXetc*/intmain(){pid_tchild;longorig_eax;child=fork();if(child==0){ptrace(PTRACE_TRACEME,0,NULL,NULL);execl("/bin/ls","ls",NULL);}else{wait(NULL);orig_ea

使用 ptrace() 取消系统调用

出于某些安全目的,我使用ptrace获取系统调用编号,如果这是一个危险的调用(例如10表示取消链接),我想取消此系统调用。这里是测试程序del.c的源代码。用gcc-odeldel.c编译。#include#includeintmain(){remove("/root/abc.out");return0;}这是安全管理器源代码test.c。用gcc-otesttest.c编译。#include#include#include#include#include#include#include#include#include#includeintmain(){inti;pid_tchild;

使用 ptrace() 取消系统调用

出于某些安全目的,我使用ptrace获取系统调用编号,如果这是一个危险的调用(例如10表示取消链接),我想取消此系统调用。这里是测试程序del.c的源代码。用gcc-odeldel.c编译。#include#includeintmain(){remove("/root/abc.out");return0;}这是安全管理器源代码test.c。用gcc-otesttest.c编译。#include#include#include#include#include#include#include#include#include#includeintmain(){inti;pid_tchild;