This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 2/4] x86: kprobe cleanup resume_execution
- From: Harvey Harrison <harvey dot harrison at gmail dot com>
- To: Ingo Molnar <mingo at elte dot hu>
- Cc: Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, Jim Keniston <jkenisto at us dot ibm dot com>, Roland McGrath <roland at redhat dot com>, Arjan van de Ven <arjan at infradead dot org>, prasanna at in dot ibm dot com, anil dot s dot keshavamurthy at intel dot com, davem at davemloft dot net, systemtap-ml <systemtap at sources dot redhat dot com>, LKML <linux-kernel at vger dot kernel dot org>, Andrew Morton <akpm at linux-foundation dot org>
- Date: Mon, 17 Dec 2007 13:27:01 -0800
- Subject: [PATCH 2/4] x86: kprobe cleanup resume_execution
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; bh=Mt4UvYG7YmMCtkb1IXaLGgadYDtaDgxTBjhV8MaN9Uk=; b=ZTznpx4kwnZnBARScTeBwV1LUSacqAiOHmo+tLkTwXXylOmA086NqE45irMcGlv5RdrRooQLjPm2/mQnN/Uvc+FkDtzRYWalpLt8a/pBNDNf6ALwspbwz6S/dnekLZI1Izone5ITUje/VbWdOSp4BM8Ph/7Wl/JB4/qxdulT6Ak=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=l8eQbBrv+tscM4s+MJ52gV2pu1Ch/YJWCiJqShVmK94mWiQ8EKxAqjwVmkF9VrfEIPaUuLhKNrRJYPhgggtR/c+ugOq+keLDrZiP8aiSBgb+/8Sxlip8zVADk4gwdkAfrEe+jgG/+x0hzJ61a4Dn0l/qfhDbgM2SV7lma8LEVUE=
This patch cleans up and fixes bugs in resume_execution on x86-64.
Kprobes for x86-64 may cause a kernel crash if it inserted on "iret"
instruction.
"call absolute" case 0x9a is invalid on x86-64, so we don't need
treat it, leave it ifdef X86_32.
- Add "iret"(0xcf) case.to X86_64
- Fold jmp absolute (0xea) handling into iret/ret/lret handling
Based on patch from Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
arch/x86/kernel/kprobes.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 9130c01..64c702c 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -748,12 +748,13 @@ static void __kprobes resume_execution(struct kprobe *p,
*tos &= ~(TF_MASK | IF_MASK);
*tos |= kcb->kprobe_old_flags;
break;
- case 0xc2: /* ret/lret */
+ case 0xc2: /* iret/ret/lret */
case 0xc3:
case 0xca:
case 0xcb:
+ case 0xcf:
+ case 0xea: /* jmp absolute -- ip is correct */
#ifdef CONFIG_X86_32
- case 0xcf: /* iret */
/* ip is already adjusted, no more changes required */
p->ainsn.boostable = 1;
#endif
@@ -783,12 +784,6 @@ static void __kprobes resume_execution(struct kprobe *p,
goto no_change;
}
break;
- case 0xea: /* jmp absolute -- ip is correct */
-#ifdef CONFIG_X86_32
- /* ip is already adjusted, no more changes required */
- p->ainsn.boostable = 1;
-#endif
- goto no_change;
default:
break;
}
--
1.5.4.rc0.1083.gf568