{"id":204,"date":"2016-06-19T01:02:42","date_gmt":"2016-06-18T17:02:42","guid":{"rendered":"http:\/\/www.zhuyanbin.com\/?p=204"},"modified":"2016-06-19T01:02:42","modified_gmt":"2016-06-18T17:02:42","slug":"linux-%e5%88%86%e6%9e%90-ptrace%ef%bc%88%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.yanbin888.com\/?p=204","title":{"rendered":"linux \u5206\u6790 ptrace\uff08\uff09"},"content":{"rendered":"<p><b>\u5f62\u5f0f<\/b><\/p>\n<p>#include &lt;sys\/ptrace.h&gt;<\/p>\n<p>int ptrace(int request, int pid, int addr, int data);<\/p>\n<p><wbr \/><\/p>\n<p><b>\u63cf\u8ff0<\/b><\/p>\n<p>Ptrace \u63d0\u4f9b\u4e86\u4e00\u79cd\u7236\u8fdb\u7a0b\u53ef\u4ee5\u63a7\u5236\u5b50\u8fdb\u7a0b\u8fd0\u884c\uff0c\u5e76\u53ef\u4ee5\u68c0\u67e5\u548c\u6539\u53d8\u5b83\u7684\u6838\u5fc3image\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u5b9e\u73b0\u65ad\u70b9\u8c03\u8bd5\u3002\u4e00\u4e2a\u88ab\u8ddf\u8e2a\u7684\u8fdb\u7a0b\u8fd0\u884c\u4e2d\uff0c\u76f4\u5230\u53d1\u751f\u4e00\u4e2a\u4fe1\u53f7\u3002\u5219\u8fdb\u7a0b\u88ab\u4e2d\u6b62\uff0c\u5e76\u4e14\u901a\u77e5\u5176\u7236\u8fdb\u7a0b\u3002\u5728\u8fdb\u7a0b\u4e2d\u6b62\u7684\u72b6\u6001\u4e0b\uff0c\u8fdb\u7a0b\u7684\u5185\u5b58\u7a7a\u95f4\u53ef\u4ee5\u88ab\u8bfb\u5199\u3002\u7236\u8fdb\u7a0b\u8fd8\u53ef\u4ee5\u4f7f\u5b50\u8fdb\u7a0b\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u9009\u62e9\u662f\u5426\u662f\u5426\u5ffd\u7565\u5f15\u8d77\u4e2d\u6b62\u7684\u4fe1\u53f7\u3002<\/p>\n<p>Request\u53c2\u6570\u51b3\u5b9a\u4e86\u7cfb\u7edf\u8c03\u7528\u7684\u529f\u80fd\uff1a<\/p>\n<p>PTRACE_TRACEME<\/p>\n<p>\u672c\u8fdb\u7a0b\u88ab\u5176\u7236\u8fdb\u7a0b\u6240\u8ddf\u8e2a\u3002\u5176\u7236\u8fdb\u7a0b\u5e94\u8be5\u5e0c\u671b\u8ddf\u8e2a\u5b50\u8fdb\u7a0b\u3002<\/p>\n<p>PTRACE_PEEKTEXT, PTRACE_PEEKDATA<\/p>\n<p>\u4ece\u5185\u5b58\u5730\u5740\u4e2d\u8bfb\u53d6\u4e00\u4e2a\u5b57\u8282\uff0c\u5185\u5b58\u5730\u5740\u7531addr\u7ed9\u51fa\u3002<\/p>\n<p>PTRACE_PEEKUSR<\/p>\n<p>\u4eceUSER\u533a\u57df\u4e2d\u8bfb\u53d6\u4e00\u4e2a\u5b57\u8282\uff0c\u504f\u79fb\u91cf\u4e3aaddr\u3002<\/p>\n<p>PTRACE_POKETEXT, PTRACE_POKEDATA<\/p>\n<p>\u5f80\u5185\u5b58\u5730\u5740\u4e2d\u5199\u5165\u4e00\u4e2a\u5b57\u8282\u3002\u5185\u5b58\u5730\u5740\u7531addr\u7ed9\u51fa\u3002<\/p>\n<p>PTRACE_POKEUSR<\/p>\n<p>\u5f80USER\u533a\u57df\u4e2d\u5199\u5165\u4e00\u4e2a\u5b57\u8282\u3002\u504f\u79fb\u91cf\u4e3aaddr\u3002<\/p>\n<p>PTRACE_SYSCALL, PTRACE_CONT<\/p>\n<p>\u91cd\u65b0\u8fd0\u884c\u3002<\/p>\n<p>PTRACE_KILL<\/p>\n<p>\u6740\u6389\u5b50\u8fdb\u7a0b\uff0c\u4f7f\u5b83\u9000\u51fa\u3002<\/p>\n<p>PTRACE_SINGLESTEP<\/p>\n<p>\u8bbe\u7f6e\u5355\u6b65\u6267\u884c\u6807\u5fd7<\/p>\n<p>PTRACE_ATTACH<\/p>\n<p>\u8ddf\u8e2a\u6307\u5b9apid \u8fdb\u7a0b\u3002<\/p>\n<p>PTRACE_DETACH<\/p>\n<p>\u7ed3\u675f\u8ddf\u8e2a<\/p>\n<p>Intel386\u7279\u6709\uff1a<\/p>\n<p>PTRACE_GETREGS<\/p>\n<p>\u8bfb\u53d6\u5bc4\u5b58\u5668<\/p>\n<p>PTRACE_SETREGS<\/p>\n<p>\u8bbe\u7f6e\u5bc4\u5b58\u5668<\/p>\n<p>PTRACE_GETFPREGS<\/p>\n<p>\u8bfb\u53d6\u6d6e\u70b9\u5bc4\u5b58\u5668<\/p>\n<p>PTRACE_SETFPREGS<\/p>\n<p>\u8bbe\u7f6e\u6d6e\u70b9\u5bc4\u5b58\u5668<\/p>\n<p>init\u8fdb\u7a0b\u4e0d\u53ef\u4ee5\u4f7f\u7528\u6b64\u51fd\u6570<\/p>\n<p><wbr \/><\/p>\n<p><b>\u8fd4\u56de\u503c<\/b><\/p>\n<p>\u6210\u529f\u8fd4\u56de0\u3002\u9519\u8bef\u8fd4\u56de-1\u3002errno\u88ab\u8bbe\u7f6e\u3002<\/p>\n<p><wbr \/><\/p>\n<p><b>\u9519\u8bef<\/b><\/p>\n<p>EPERM<\/p>\n<p>\u7279\u6b8a\u8fdb\u7a0b\u4e0d\u53ef\u4ee5\u88ab\u8ddf\u8e2a\u6216\u8fdb\u7a0b\u5df2\u7ecf\u88ab\u8ddf\u8e2a\u3002<\/p>\n<p>ESRCH<\/p>\n<p>\u6307\u5b9a\u7684\u8fdb\u7a0b\u4e0d\u5b58\u5728<\/p>\n<p>EIO<\/p>\n<p>\u8bf7\u6c42\u975e\u6cd5<\/p>\n<p>ptrace\u7cfb\u7edf\u51fd\u6570\u3002 ptrace\u63d0\u4f9b\u4e86\u4e00\u79cd\u4f7f\u7236\u8fdb\u7a0b\u5f97\u4ee5\u76d1\u89c6\u548c\u63a7\u5236\u5176\u5b83\u8fdb\u7a0b\u7684\u65b9\u5f0f\uff0c\u5b83\u8fd8\u80fd\u591f\u6539\u53d8\u5b50\u8fdb\u7a0b\u4e2d\u7684\u5bc4\u5b58\u5668\u548c\u5185\u6838\u6620\u50cf\uff0c\u56e0\u800c\u53ef\u4ee5\u5b9e\u73b0\u65ad\u70b9\u8c03\u8bd5\u548c\u7cfb\u7edf\u8c03\u7528\u7684\u8ddf\u8e2a\u3002\u4f7f\u7528ptrace\uff0c\u4f60\u53ef\u4ee5\u5728\u7528\u6237\u5c42\u62e6\u622a\u548c\u4fee\u6539\u7cfb\u7edf\u8c03\u7528(sys call).<\/p>\n<h2><a name=\"_Toc454513428\"><\/a>\u529f\u80fd\u8be6\u7ec6\u63cf\u8ff0<\/h2>\n<h3><a name=\"_Toc454513429\"><\/a>1)\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_TRACEME<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_TRACEME,0 ,0 ,0)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u672c\u8fdb\u7a0b\u88ab\u5176\u7236\u8fdb\u7a0b\u6240\u8ddf\u8e2a\u3002\u5176\u7236\u8fdb\u7a0b\u5e94\u8be5\u5e0c\u671b\u8ddf\u8e2a\u5b50\u8fdb\u7a0b\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513430\"><\/a>2)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_PEEKTEXT, PTRACE_PEEKDATA<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_PEEKTEXT, pid, addr, data)<\/p>\n<p><wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/> \u00a0<wbr \/> ptrace(PTRACE_PEEKDATA, pid, addr, data)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u4ece\u5185\u5b58\u5730\u5740\u4e2d\u8bfb\u53d6\u4e00\u4e2a\u5b57\u8282\uff0cpid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0c\u5185\u5b58\u5730\u5740\u7531addr\u7ed9\u51fa\uff0cdata\u4e3a\u7528\u6237\u53d8\u91cf\u5730\u5740\u7528\u4e8e\u8fd4\u56de\u8bfb\u5230\u7684\u6570\u636e\u3002\u5728Linux\uff08i386\uff09\u4e2d\u7528\u6237\u4ee3\u7801\u6bb5\u4e0e\u7528\u6237\u6570\u636e\u6bb5\u91cd\u5408\u6240\u4ee5\u8bfb\u53d6\u4ee3\u7801\u6bb5\u548c\u6570\u636e\u6bb5\u6570\u636e\u5904\u7406\u662f\u4e00\u6837\u7684\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513431\"><\/a>3)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_POKETEXT, PTRACE_POKEDATA<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_POKETEXT, pid, addr, data)<\/p>\n<p><wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/> \u00a0<wbr \/> ptrace(PTRACE_POKEDATA, pid, addr, data)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u5f80\u5185\u5b58\u5730\u5740\u4e2d\u5199\u5165\u4e00\u4e2a\u5b57\u8282\u3002pid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0c\u5185\u5b58\u5730\u5740\u7531addr\u7ed9\u51fa\uff0cdata\u4e3a\u6240\u8981\u5199\u5165\u7684\u6570\u636e\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513432\"><\/a>4)\u00a0<wbr \/>\u00a0<wbr \/>TRACE_PEEKUSR<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_PEEKUSR, pid, addr, data)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u4eceUSER\u533a\u57df\u4e2d\u8bfb\u53d6\u4e00\u4e2a\u5b57\u8282\uff0cpid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0cUSER\u533a\u57df\u5730\u5740\u7531addr\u7ed9\u51fa\uff0cdata\u4e3a\u7528\u6237\u53d8\u91cf\u5730\u5740\u7528\u4e8e\u8fd4\u56de\u8bfb\u5230\u7684\u6570\u636e\u3002USER\u7ed3\u6784\u4e3acore\u6587\u4ef6\u7684\u524d\u9762\u4e00\u90e8\u5206\uff0c\u5b83\u63cf\u8ff0\u4e86\u8fdb\u7a0b\u4e2d\u6b62\u65f6\u7684\u4e00\u4e9b\u72b6\u6001\uff0c\u5982\uff1a\u5bc4\u5b58\u5668\u503c\uff0c\u4ee3\u7801\u3001\u6570\u636e\u6bb5\u5927\u5c0f\uff0c\u4ee3\u7801\u3001\u6570\u636e\u6bb5\u5f00\u59cb\u5730\u5740\u7b49\u3002\u5728Linux\uff08i386\uff09\u4e2d\u901a\u8fc7PTRACE_PEEKUSER\u548cPTRACE_POKEUSR\u53ef\u4ee5\u8bbf\u95eeUSER\u7ed3\u6784\u7684\u6570\u636e\u6709\u5bc4\u5b58\u5668\u548c\u8c03\u8bd5\u5bc4\u5b58\u5668\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513433\"><\/a>5)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_POKEUSR<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_POKEUSR, pid, addr, data)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u5f80USER\u533a\u57df\u4e2d\u5199\u5165\u4e00\u4e2a\u5b57\u8282\uff0cpid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0cUSER\u533a\u57df\u5730\u5740\u7531addr\u7ed9\u51fa\uff0cdata\u4e3a\u9700\u5199\u5165\u7684\u6570\u636e\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513434\"><\/a>6)\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_CONT<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_CONT, pid, 0, signal)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u7ee7\u7eed\u6267\u884c\u3002pid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0csignal\u4e3a0\u5219\u5ffd\u7565\u5f15\u8d77\u8c03\u8bd5\u8fdb\u7a0b\u4e2d\u6b62\u7684\u4fe1\u53f7\uff0c\u82e5\u4e0d\u4e3a0\u5219\u7ee7\u7eed\u5904\u7406\u4fe1\u53f7signal\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513435\"><\/a>7)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_SYSCALL<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_SYS, pid, 0, signal)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u7ee7\u7eed\u6267\u884c\u3002pid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0csignal\u4e3a0\u5219\u5ffd\u7565\u5f15\u8d77\u8c03\u8bd5\u8fdb\u7a0b\u4e2d\u6b62\u7684\u4fe1\u53f7\uff0c\u82e5\u4e0d\u4e3a0\u5219\u7ee7\u7eed\u5904\u7406\u4fe1\u53f7signal\u3002\u4e0ePTRACE_CONT\u4e0d\u540c\u7684\u662f\u8fdb\u884c\u7cfb\u7edf\u8c03\u7528\u8ddf\u8e2a\u3002\u5728\u88ab\u8ddf\u8e2a\u8fdb\u7a0b\u7ee7\u7eed\u8fd0\u884c\u76f4\u5230\u8c03\u7528\u7cfb\u7edf\u8c03\u7528\u5f00\u59cb\u6216\u7ed3\u675f\u65f6\uff0c\u88ab\u8ddf\u8e2a\u8fdb\u7a0b\u88ab\u4e2d\u6b62\uff0c\u5e76\u901a\u77e5\u7236\u8fdb\u7a0b\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513436\"><\/a>8)\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_KILL<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_KILL,pid)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u6740\u6389\u5b50\u8fdb\u7a0b\uff0c\u4f7f\u5b83\u9000\u51fa\u3002pid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513437\"><\/a>9)\u00a0<wbr \/>\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_SINGLESTEP<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_KILL, pid, 0, signle)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u8bbe\u7f6e\u5355\u6b65\u6267\u884c\u6807\u5fd7\uff0c\u5355\u6b65\u6267\u884c\u4e00\u6761\u6307\u4ee4\u3002pid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\u3002signal\u4e3a0\u5219\u5ffd\u7565\u5f15\u8d77\u8c03\u8bd5\u8fdb\u7a0b\u4e2d\u6b62\u7684\u4fe1\u53f7\uff0c\u82e5\u4e0d\u4e3a0\u5219\u7ee7\u7eed\u5904\u7406\u4fe1\u53f7signal\u3002\u5f53\u88ab\u8ddf\u8e2a\u8fdb\u7a0b\u5355\u6b65\u6267\u884c\u5b8c\u4e00\u4e2a\u6307\u4ee4\u540e\uff0c\u88ab\u8ddf\u8e2a\u8fdb\u7a0b\u88ab\u4e2d\u6b62\uff0c\u5e76\u901a\u77e5\u7236\u8fdb\u7a0b\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513438\"><\/a>10)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_ATTACH<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_ATTACH,pid)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u8ddf\u8e2a\u6307\u5b9apid \u8fdb\u7a0b\u3002pid\u8868\u793a\u88ab\u8ddf\u8e2a\u8fdb\u7a0b\u3002\u88ab\u8ddf\u8e2a\u8fdb\u7a0b\u5c06\u6210\u4e3a\u5f53\u524d\u8fdb\u7a0b\u7684\u5b50\u8fdb\u7a0b\uff0c\u5e76\u8fdb\u5165\u4e2d\u6b62\u72b6\u6001\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513439\"><\/a>11)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_DETACH<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_DETACH,pid)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u7ed3\u675f\u8ddf\u8e2a\u3002 pid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\u3002\u7ed3\u675f\u8ddf\u8e2a\u540e\u88ab\u8ddf\u8e2a\u8fdb\u7a0b\u5c06\u7ee7\u7eed\u6267\u884c\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513440\"><\/a>12)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_GETREGS<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_GETREGS, pid, 0, data)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u8bfb\u53d6\u5bc4\u5b58\u5668\u503c\uff0cpid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0cdata\u4e3a\u7528\u6237\u53d8\u91cf\u5730\u5740\u7528\u4e8e\u8fd4\u56de\u8bfb\u5230\u7684\u6570\u636e\u3002\u6b64\u529f\u80fd\u5c06\u8bfb\u53d6\u6240\u670917\u4e2a\u57fa\u672c\u5bc4\u5b58\u5668\u7684\u503c\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513441\"><\/a>13)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_SETREGS<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_SETREGS, pid, 0, data)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u8bbe\u7f6e\u5bc4\u5b58\u5668\u503c\uff0cpid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0cdata\u4e3a\u7528\u6237\u6570\u636e\u5730\u5740\u3002\u6b64\u529f\u80fd\u5c06\u8bbe\u7f6e\u6240\u670917\u4e2a\u57fa\u672c\u5bc4\u5b58\u5668\u7684\u503c\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513442\"><\/a>14)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_GETFPREGS<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_GETFPREGS, pid, 0, data)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u8bfb\u53d6\u6d6e\u70b9\u5bc4\u5b58\u5668\u503c\uff0cpid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0cdata\u4e3a\u7528\u6237\u53d8\u91cf\u5730\u5740\u7528\u4e8e\u8fd4\u56de\u8bfb\u5230\u7684\u6570\u636e\u3002\u6b64\u529f\u80fd\u5c06\u8bfb\u53d6\u6240\u6709\u6d6e\u70b9\u534f\u5904\u7406\u5668387\u7684\u6240\u6709\u5bc4\u5b58\u5668\u7684\u503c\u3002<\/p>\n<p><wbr \/><\/p>\n<h3><a name=\"_Toc454513443\"><\/a>15)\u00a0<wbr \/>\u00a0<wbr \/>PTRACE_SETFPREGS<\/h3>\n<p><b>\u5f62\u5f0f\uff1a<\/b>ptrace(PTRACE_SETREGS, pid, 0, data)<\/p>\n<p><b>\u63cf\u8ff0\uff1a<\/b>\u8bbe\u7f6e\u6d6e\u70b9\u5bc4\u5b58\u5668\u503c\uff0cpid\u8868\u793a\u88ab\u8ddf\u8e2a\u7684\u5b50\u8fdb\u7a0b\uff0cdata\u4e3a\u7528\u6237\u6570\u636e\u5730\u5740\u3002\u6b64\u529f\u80fd\u5c06\u8bbe\u7f6e\u6240\u6709\u6d6e\u70b9\u534f\u5904\u7406\u5668387\u7684\u6240\u6709\u5bc4\u5b58\u5668\u7684\u503c\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>link:\u00a0http:\/\/blog.sina.com.cn\/s\/blog_4ac74e9a0100n7w1.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f62\u5f0f #include &lt;sys\/ptrace.h&gt; int ptrace(int request <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"https:\/\/www.yanbin888.com\/?p=204\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[23],"class_list":["post-204","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts\/204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=204"}],"version-history":[{"count":1,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts\/204\/revisions"}],"predecessor-version":[{"id":205,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts\/204\/revisions\/205"}],"wp:attachment":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}