From patchwork Wed Jul 10 00:47:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Poynor X-Patchwork-Id: 2825492 Return-Path: X-Original-To: patchwork-linux-arm@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 964F79F7D6 for ; Wed, 10 Jul 2013 00:48:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 779A120113 for ; Wed, 10 Jul 2013 00:48:49 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 589B4200EB for ; Wed, 10 Jul 2013 00:48:48 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uwia5-0003JG-Hr; Wed, 10 Jul 2013 00:48:29 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uwia3-0006Ti-3k; Wed, 10 Jul 2013 00:48:27 +0000 Received: from mail-qe0-x249.google.com ([2607:f8b0:400d:c02::249]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uwia0-0006TN-2l for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2013 00:48:24 +0000 Received: by mail-qe0-f73.google.com with SMTP id 1so552318qee.4 for ; Tue, 09 Jul 2013 17:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=c2n+dJASC0vr/3CIRPzTH86ZTX7s0O12eglahWO6dX4=; b=VufNgSAkQYdlNj96lu3H1SFeSl0/7LOLc/Dpln5Y6Z1YT3/SdmeA9mAReaS/DwS2Av MRilCZVdIedt+ZPkhLX1i4AMbth+IDtS3/uM832Tt+qJ+4Aa+0DW00qZcJrWv6xY5hoo ooeenu2krFIuBeNYDE00e/zCPXkpHuQcwqvKPcN9Ww06RtHRA+/TCZg/mMzaP2cof02z 65+Ofzh/mj0fMdPEHHJyhX+Gf40nSNeq14V4dR40H1HfYOgHKJBwOv18gXmFmK4z8E5M Qp5WhdU57UcRXgxEwB+A+cVGShOfDvN32X7lO7036l+HGMMpaHYwJOAdfWSzQwEJSNSu 26UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=c2n+dJASC0vr/3CIRPzTH86ZTX7s0O12eglahWO6dX4=; b=OeeVi8yoqtKgzn+EYwvaEnGl3wxJwNXW5FD2u7KcqxSRTT/c/kq5W+ALCVFjc7MbSU hn+fSD1+Mn1AKIkVMIYFrM7Jnw8pS96hZvtJTWexq8rPh8cUhQxLsCWe/rT8YVd7FOui t9YWubeaZj0Saq8YLRMt+Fi72JpDg+cgA9IaEGcPjUHldhCwfkFjTpkKe+zB+EQ0DcNu lyAsm+uu43eRoT5h1ut4Dl/BJFMw6YM7uIW9GEcPcXWxwNaiptRa/mm8Ue7r6areHTk3 16NlIPIXI6rgO54FoJ/2AKTxFBQdv0FXofQigs4jfNXN8xQsmoeDQHGXiMgAkscDAAXT ZNGQ== X-Received: by 10.236.110.168 with SMTP id u28mr15208352yhg.32.1373417280972; Tue, 09 Jul 2013 17:48:00 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id t25si14640610yhg.6.2013.07.09.17.48.00 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Tue, 09 Jul 2013 17:48:00 -0700 (PDT) Received: from toddpoynor.mtv.corp.google.com (toddpoynor.mtv.corp.google.com [172.18.121.104]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id CDE4F5A40F7; Tue, 9 Jul 2013 17:48:00 -0700 (PDT) Received: by toddpoynor.mtv.corp.google.com (Postfix, from userid 115684) id 6C77E1A0AAF; Tue, 9 Jul 2013 17:48:00 -0700 (PDT) From: Todd Poynor To: Jason Wessel , Russell King Subject: [PATCH] ARM: kgdb: ignore breakpoint instructions from user mode Date: Tue, 9 Jul 2013 17:47:39 -0700 Message-Id: <1373417259-22098-1-git-send-email-toddpoynor@google.com> X-Mailer: git-send-email 1.8.3 X-Gm-Message-State: ALoCoQly4LtXx66Lh/TeaWZqcwnXLSoAXvOS8EssK60RgLAsniU5PrGGwGgn4Fxbd93yRhEIqGygEuu4tOFlT+96n8z6LhNTfqzhnHtmNThXpvKMJKKof3cRu6XNvzDCFFOdGRmyeYHJU0UtrFx6u6c2HaSZ4DEoj/S0z/5vMtLN8vN37VsMRl0LrNIIda9lQ+3sIz/IrkhsrprPtsnnLbYFclDCjFDLXQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130709_204824_198075_E8CD5D18 X-CRM114-Status: UNSURE ( 9.36 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) Cc: Todd Poynor , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 Avoid conflicts with user mode usage of the same instructions, as with Clang -ftrapv, and avoid a potential denial of service. Signed-off-by: Todd Poynor --- arch/arm/kernel/kgdb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c index 778c2f7..b321c8f 100644 --- a/arch/arm/kernel/kgdb.c +++ b/arch/arm/kernel/kgdb.c @@ -144,6 +144,8 @@ int kgdb_arch_handle_exception(int exception_vector, int signo, static int kgdb_brk_fn(struct pt_regs *regs, unsigned int instr) { + if (user_mode(regs)) + return -1; kgdb_handle_exception(1, SIGTRAP, 0, regs); return 0; @@ -151,6 +153,8 @@ static int kgdb_brk_fn(struct pt_regs *regs, unsigned int instr) static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr) { + if (user_mode(regs)) + return -1; compiled_break = 1; kgdb_handle_exception(1, SIGTRAP, 0, regs);