From patchwork Wed Jun 19 11:42:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 2748821 X-Patchwork-Delegate: lethal@linux-sh.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6AB189F8E1 for ; Wed, 19 Jun 2013 12:00:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A67C02030B for ; Wed, 19 Jun 2013 12:00:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B266520306 for ; Wed, 19 Jun 2013 12:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934426Ab3FSMAG (ORCPT ); Wed, 19 Jun 2013 08:00:06 -0400 Received: from mailxx.hitachi.co.jp ([133.145.228.50]:59277 "EHLO mailxx.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934052Ab3FSMAF (ORCPT ); Wed, 19 Jun 2013 08:00:05 -0400 X-Greylist: delayed 872 seconds by postgrey-1.27 at vger.kernel.org; Wed, 19 Jun 2013 08:00:05 EDT Received: from mail4.hitachi.co.jp by mailxx.hitachi.co.jp (8.9.3p3/3.7W-mailx) id UAA15395; Wed, 19 Jun 2013 20:47:43 +0900 Received: from mlsv2.hitachi.co.jp (unknown [133.144.234.166]) by mail4.hitachi.co.jp (Postfix) with ESMTP id D61F333CC2; Wed, 19 Jun 2013 20:45:31 +0900 (JST) Received: from mfilter04.hitachi.co.jp by mlsv2.hitachi.co.jp (8.13.1/8.13.1) id r5JBjVjv020408; Wed, 19 Jun 2013 20:45:31 +0900 Received: from vshuts02.hitachi.co.jp (vshuts02.hitachi.co.jp [10.201.6.84]) by mfilter04.hitachi.co.jp (Switch-3.3.4/Switch-3.3.4) with ESMTP id r5JBjUon014614; Wed, 19 Jun 2013 20:45:31 +0900 Received: from gmml27.itg.hitachi.co.jp (unknown [158.213.165.130]) by vshuts02.hitachi.co.jp (Postfix) with ESMTP id 86EC249004D; Wed, 19 Jun 2013 20:45:30 +0900 (JST) Received: from [127.0.1.1] by gmml27.itg.hitachi.co.jp (AIX5.2/8.11.6p2/8.11.0) id r5JBjUD2850940; Wed, 19 Jun 2013 20:45:30 +0900 Subject: [PATCH] sh/kprobes: Fix illslot handler not to unregister but disarm kprobe To: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org From: Masami Hiramatsu Cc: Sasha Levin , Andrew Morton , Paul Mundt , "Paul E. McKenney" , yrl.pp-manager.tt@hitachi.com Date: Wed, 19 Jun 2013 20:42:44 +0900 Message-ID: <20130619114244.19843.90351.stgit@mhiramat-M0-7522> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix illegal slot exception handler not to unregister the kprobe but just to disarm it. Since the unregister_kprobe must sleep (by synchronize_sched), it must not be called from any exception/ interrupt handlers. Disarming is safe because it just recovers original instruction code. Signed-off-by: Masami Hiramatsu Cc: Paul Mundt Cc: Sasha Levin Cc: Andrew Morton Cc: "Paul E. McKenney" --- arch/sh/kernel/kprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c index 42b46e6..5ec8182 100644 --- a/arch/sh/kernel/kprobes.c +++ b/arch/sh/kernel/kprobes.c @@ -82,7 +82,7 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p) /** * If an illegal slot instruction exception occurs for an address - * containing a kprobe, remove the probe. + * containing a kprobe, disarm the probe. * * Returns 0 if the exception was handled successfully, 1 otherwise. */ @@ -93,7 +93,7 @@ int __kprobes kprobe_handle_illslot(unsigned long pc) if (p != NULL) { printk("Warning: removing kprobe from delay slot: 0x%.8x\n", (unsigned int)pc + 2); - unregister_kprobe(p); + arch_disarm_kprobe(p); return 0; }