From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12784 invoked by alias); 27 Feb 2006 11:57:15 -0000 Received: (qmail 12767 invoked by uid 22791); 27 Feb 2006 11:57:14 -0000 X-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_05,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mail7.hitachi.co.jp (HELO mail7.hitachi.co.jp) (133.145.228.42) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 27 Feb 2006 11:57:09 +0000 Received: from mlsv3.hitachi.co.jp by mail7.hitachi.co.jp (8.9.3p3/3.7W-mail7) id UAA29271; Mon, 27 Feb 2006 20:57:06 +0900 Received: from mfilter-s6.hitachi.co.jp by mlsv3.hitachi.co.jp (8.12.10/8.12.10) id k1RBv5SI027472; Mon, 27 Feb 2006 20:57:05 +0900 Received: from vshuts5.hitachi.co.jp (unverified) by mfilter-s6.hitachi.co.jp (Content Technologies SMTPRS 4.3.17) with SMTP id ; Mon, 27 Feb 2006 20:57:05 +0900 Received: from hsdlgw92.sdl.hitachi.co.jp ([133.144.7.20]) by vshuts5.hitachi.co.jp with SMTP id M2006022720570509058 ; Mon, 27 Feb 2006 20:57:05 +0900 Received: from vgate2.sdl.hitachi.co.jp by hsdlgw92.sdl.hitachi.co.jp (8.9.3/3.7W01100113) id UAA24718; Mon, 27 Feb 2006 20:57:04 +0900 Received: from maila.sdl.hitachi.co.jp ([133.144.14.196]) by vgate2.sdl.hitachi.co.jp (SAVSMTP 3.1.1.32) with SMTP id M2006022720570414601 ; Mon, 27 Feb 2006 20:57:04 +0900 Received: from [192.168.16.226] ([192.168.16.226]) by maila.sdl.hitachi.co.jp (8.13.1/3.7W04031011) with ESMTP id k1RBv4BB005826; Mon, 27 Feb 2006 20:57:04 +0900 Message-ID: <4402E914.9010206@sdl.hitachi.co.jp> Date: Mon, 27 Feb 2006 11:57:00 -0000 From: Masami Hiramatsu User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Andrew Morton , Ananth N Mavinakayanahalli , Prasanna S Panchamukhi , "Keshavamurthy, Anil S" CC: Masami Hiramatsu , SystemTAP , Jim Keniston , linux-kernel@vger.kernel.org, Yumiko Sugita , Satoshi Oshima , Hideo Aoki Subject: [PATCH][take2][1/2] kprobe: cleanup resume_execute against 2.6.16-rc5 for i386 References: <43DE0A41.8020207@sdl.hitachi.co.jp> In-Reply-To: <43DE0A41.8020207@sdl.hitachi.co.jp> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q1/txt/msg00638.txt.bz2 Hi, Andrew The kprobe-booster's patches in current -mm tree (kprobes-clean-up-resume_execute.patch and x86-kprobes-booster.patch) are under the influence of the NX-protection support patch which was merged into linus tree(2.6.16-rc5). So I fixed those patches. Here is a patch to clean up kprobe's resume_execute() for i386 arch against linux-2.6.16-rc5. This patch makes resume_execute() simple, and useful to simplify the kprobe-booster patch. Could you replace the previous patches with these patches? Best Regards, -- Masami HIRAMATSU 2nd Research Dept. Hitachi, Ltd., Systems Development Laboratory E-mail: hiramatu@sdl.hitachi.co.jp Signed-off-by: Masami Hiramatsu kprobes.c | 26 ++++++++++---------------- 1 files changed, 10 insertions(+), 16 deletions(-) diff -Narup a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c --- a/arch/i386/kernel/kprobes.c 2006-02-27 16:21:33.000000000 +0900 +++ b/arch/i386/kernel/kprobes.c 2006-02-27 16:30:58.000000000 +0900 @@ -362,10 +362,10 @@ static void __kprobes resume_execution(s struct pt_regs *regs, struct kprobe_ctlblk *kcb) { unsigned long *tos = (unsigned long *)®s->esp; - unsigned long next_eip = 0; unsigned long copy_eip = (unsigned long)p->ainsn.insn; unsigned long orig_eip = (unsigned long)p->addr; + regs->eflags &= ~TF_MASK; switch (p->ainsn.insn[0]) { case 0x9c: /* pushfl */ *tos &= ~(TF_MASK | IF_MASK); @@ -375,9 +375,9 @@ static void __kprobes resume_execution(s case 0xcb: case 0xc2: case 0xca: - regs->eflags &= ~TF_MASK; - /* eip is already adjusted, no more changes required*/ - return; + case 0xea: /* jmp absolute -- eip is correct */ + /* eip is already adjusted, no more changes required */ + goto no_change; case 0xe8: /* call relative - Fix return addr */ *tos = orig_eip + (*tos - copy_eip); break; @@ -385,27 +385,21 @@ static void __kprobes resume_execution(s if ((p->ainsn.insn[1] & 0x30) == 0x10) { /* call absolute, indirect */ /* Fix return addr; eip is correct. */ - next_eip = regs->eip; *tos = orig_eip + (*tos - copy_eip); + goto no_change; } else if (((p->ainsn.insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */ ((p->ainsn.insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */ /* eip is correct. */ - next_eip = regs->eip; + goto no_change; } - break; - case 0xea: /* jmp absolute -- eip is correct */ - next_eip = regs->eip; - break; default: break; } - regs->eflags &= ~TF_MASK; - if (next_eip) { - regs->eip = next_eip; - } else { - regs->eip = orig_eip + (regs->eip - copy_eip); - } + regs->eip = orig_eip + (regs->eip - copy_eip); + +no_change: + return; } /*