小编r00*_*0t_的帖子

ptrace PTRACE_ATTACH失败 - 用户拥有进程的Linux权限

为什么我需要以root身份运行(而不是r00t_)?

// main()
scan.scanProcessOffset(10838, 0x7f8c14000000); // proper pid and offset

void MemoryMapper::scanProcessOffset(unsigned int procId, unsigned long long offset)
{
    long attach = ptrace(PTRACE_ATTACH, procId, NULL, NULL);
    cout << attach << endl << errno << endl;

    long memory = ptrace(PTRACE_PEEKDATA, procId, offset);
    if (memory == -1 && errno == 3)
    {
        cout << errno << endl;
        errno = 0;
    }

    cout << memory;
}
Run Code Online (Sandbox Code Playgroud)

正如您所看到的那样,我正在进行的过程由r00t_拥有

r00t_@:/proc/10838$ ls -l 
lrwxrwxrwx 1 r00t r00t_ 0 2012-04-15 08:21 exe -> /usr/bin/gedit
-rw------- 1 r00t …
Run Code Online (Sandbox Code Playgroud)

c++ linux memory ptrace

2
推荐指数
1
解决办法
3396
查看次数

标签 统计

c++ ×1

linux ×1

memory ×1

ptrace ×1