From: Philip Homburg Date: Fri, 20 Oct 2006 14:14:08 +0000 (+0000) Subject: Additional ptrace commands for fault injection. X-Git-Tag: v3.1.3~168 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/soc.html?a=commitdiff_plain;h=1ce2f756277b5fa497c8e91221e0bc690a975f97;p=minix.git Additional ptrace commands for fault injection. --- diff --git a/servers/pm/trace.c b/servers/pm/trace.c index 600a1404a..8f4c37314 100644 --- a/servers/pm/trace.c +++ b/servers/pm/trace.c @@ -47,6 +47,35 @@ PUBLIC int do_trace() mp->mp_reply.reply_trace = 0; return(OK); } + if (m_in.request == T_READB_INS) + { + /* Special hack for reading text segments */ + if (mp->mp_effuid != SUPER_USER) + return(EPERM); + if ((child=find_proc(m_in.pid))==NIL_MPROC) + return(ESRCH); + + r= sys_trace(m_in.request,child->mp_endpoint,m_in.taddr,&m_in.data); + if (r != OK) return(r); + + mp->mp_reply.reply_trace = m_in.data; + return(OK); + } + if (m_in.request == T_WRITEB_INS) + { + /* Special hack for patching text segments */ + if (mp->mp_effuid != SUPER_USER) + return(EPERM); + if ((child=find_proc(m_in.pid))==NIL_MPROC) + return(ESRCH); + + r= sys_trace(m_in.request,child->mp_endpoint,m_in.taddr,&m_in.data); + if (r != OK) return(r); + + mp->mp_reply.reply_trace = m_in.data; + return(OK); + } + if ((child=find_proc(m_in.pid))==NIL_MPROC || !(child->mp_flags & STOPPED)) { return(ESRCH); }