From 1ce2f756277b5fa497c8e91221e0bc690a975f97 Mon Sep 17 00:00:00 2001 From: Philip Homburg Date: Fri, 20 Oct 2006 14:14:08 +0000 Subject: [PATCH] Additional ptrace commands for fault injection. --- servers/pm/trace.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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); } -- 2.44.0