From patchwork Fri May 4 04:15:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 10379825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F308603B4 for ; Fri, 4 May 2018 04:17:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EFF528CE8 for ; Fri, 4 May 2018 04:17:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FD2328E19; Fri, 4 May 2018 04:17:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 887AF28CE8 for ; Fri, 4 May 2018 04:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4FAVxiAHF29CDOHGDn86fAhCQ6ljU4nomwJ8v02Oiq0=; b=s6QgiADGiBp9BQ EfnHW+24Ye8bx/Y4WJ7isaZq+zHv7TiUjp6Hp//WWhz5jqmXF9f/cfh4o2uztFWCfGM7lmtoOypG8 ApEJ9N0x6NrCCua2+pxGx/ggGrwKnNh/QFzpkgbhGkfas/H5KNaBjhmLM9EDl4cavKtwQ8+UiVREF Ea94hSz8NKBdgghMN/bq2Cyv5T/HU7U8zxLmaEiqZFDIIRpU5sKKdi8Gj5hMvHKqmbdJZ8FKaI/IA wcvqPXNDPk+mb6/kHvwoAyauXq1cY8684nf7SvjH/eQA0iNF7yNNyd3+GikRtY46kpRkqmKBH1oTY yrssotGvfRZA/+n1UZBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fESA4-0000Uv-Kr; Fri, 04 May 2018 04:17:36 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fES92-000864-EA for linux-arm-kernel@lists.infradead.org; Fri, 04 May 2018 04:16:36 +0000 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3270E21716; Fri, 4 May 2018 04:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525407381; bh=peGT3QtWLPPRHQsk1a9vDkudbqwDp2NAMNS4QkCoy+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dhg1Ja08BbcSGVrnC8EZZc0MOT9VIsvL1uLw/OIl/JCeRPyIhptW6eJv0Of5yRvei 0VzRWNES6bJ/KqTYmmKuYDHh+rpL5Sqgtr6b6fTa08a+TXjvF9WmLbl39UZxc5+f56 RO4GoA7CbtBcgKgzm/EpaVml7+PbLyqs5fO9A4Yc= From: Masami Hiramatsu To: Russell King Subject: [BUGFIX PATCH v3 3/4] arm: kprobes: Prohibit kprobes on do_undefinstr Date: Fri, 4 May 2018 13:15:58 +0900 Message-Id: <152540735813.29650.10807161581632067171.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <152540727123.29650.13679359124038587629.stgit@devbox> References: <152540727123.29650.13679359124038587629.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180503_211632_546385_BF27A614 X-CRM114-Status: GOOD ( 11.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jon Medhurst , Wang Nan , Will Deacon , linux-kernel@vger.kernel.org, stable@vger.kernel.org, mhiramat@kernel.org, linux-arm-kernel@lists.infradead.org, David Long Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Prohibit kprobes on do_undefinstr because kprobes on arm is implemented by undefined instruction. This means if we probe do_undefinstr(), it can cause infinit recursive exception. Fixes: 24ba613c9d6c ("ARM kprobes: core code") Signed-off-by: Masami Hiramatsu Cc: stable@vger.kernel.org --- arch/arm/kernel/traps.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 5e3633c24e63..2fe87109ae46 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -417,7 +418,8 @@ void unregister_undef_hook(struct undef_hook *hook) raw_spin_unlock_irqrestore(&undef_lock, flags); } -static int call_undef_hook(struct pt_regs *regs, unsigned int instr) +static nokprobe_inline +int call_undef_hook(struct pt_regs *regs, unsigned int instr) { struct undef_hook *hook; unsigned long flags; @@ -490,6 +492,7 @@ asmlinkage void do_undefinstr(struct pt_regs *regs) arm_notify_die("Oops - undefined instruction", regs, &info, 0, 6); } +NOKPROBE_SYMBOL(do_undefinstr) /* * Handle FIQ similarly to NMI on x86 systems.