From patchwork Mon Sep 22 10:19:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 37672 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C07F821177 for ; Mon, 22 Sep 2014 10:19:32 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id a1sf1356460wgh.5 for ; Mon, 22 Sep 2014 03:19:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=AtiYcVLU6NVYM2TbLP/ASbo24W/vnLxge1Ye0ZsM7TQ=; b=Yq1eTqx8MxKF7XuVuxcLaqdNj2k8EGIjhCsLi3Sqq0iGbmSrWiETq2kcU1JWOKdVOR vLL8F4ed2pNzauhohkQZvNKqzqnKyyyPWCs3R5TMTTS8R5NQjaCu12KG0yyp7F2D8KLf u8l88Z/E2HJGPnO1vknv+bGgqG13/Uxmr14GwP0DEgUrLF9MdZkSMtt5GVFEzglAwYg5 A5nqwnEfS8XHC11ilFTEb2/d16T4aPsKX8m94wL9i/5GYYGIT62bTaerIaNjIhc0WyxM xE2IsD5LGwkpRnggePazHdmKPx0IgT9RSeL/OkepBhwhCxlFSQ9+xk8h+ZTCv2QwtD8E dYwg== X-Gm-Message-State: ALoCoQk2r6pYl3bjQxaNAH1/MxIx4he/z0ujTvSgORgTQ6UaAxNW3HzKbnHQ8BVa22/SdIMQ5YJ7 X-Received: by 10.112.118.8 with SMTP id ki8mr4395621lbb.4.1411381172004; Mon, 22 Sep 2014 03:19:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.104 with SMTP id lf8ls446257lac.87.gmail; Mon, 22 Sep 2014 03:19:31 -0700 (PDT) X-Received: by 10.112.141.7 with SMTP id rk7mr1776702lbb.83.1411381171747; Mon, 22 Sep 2014 03:19:31 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by mx.google.com with ESMTPS id ee12si13787785lbd.126.2014.09.22.03.19.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Sep 2014 03:19:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id ty20so6319826lab.7 for ; Mon, 22 Sep 2014 03:19:31 -0700 (PDT) X-Received: by 10.112.200.134 with SMTP id js6mr23301685lbc.0.1411381171628; Mon, 22 Sep 2014 03:19:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp209693lbb; Mon, 22 Sep 2014 03:19:30 -0700 (PDT) X-Received: by 10.70.34.104 with SMTP id y8mr27693967pdi.7.1411381169743; Mon, 22 Sep 2014 03:19:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oe14si14984256pdb.174.2014.09.22.03.19.29 for ; Mon, 22 Sep 2014 03:19:29 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753555AbaIVKT2 (ORCPT + 1 other); Mon, 22 Sep 2014 06:19:28 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:56492 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751905AbaIVKT1 (ORCPT ); Mon, 22 Sep 2014 06:19:27 -0400 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.204]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s8MAIxwo016763; Mon, 22 Sep 2014 11:18:59 +0100 (BST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 80DB31AE053E; Mon, 22 Sep 2014 11:19:05 +0100 (BST) From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, Will Deacon , Subject: [PATCH] arm64: debug: don't re-enable debug exceptions on return from el1_dbg Date: Mon, 22 Sep 2014 11:19:04 +0100 Message-Id: <1411381144-3528-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.0 Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.deacon@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When returning from a debug exception taken from EL1, we unmask debug exceptions after handling the exception. This is crucial for debug exceptions taken from EL0, so that any kernel work on the ret_to_user path can be debugged by kgdb. However, when returning back to EL1 the only thing left to do is to restore the original register state before the exception return. If single-step has been enabled by the debug exception handler, we will get stuck in an infinite debug exception loop, since we will take the step exception as soon as we unmask debug exceptions. This patch avoids unmasking debug exceptions on the debug exception return path when the exception was taken from EL1. Cc: Reported-by: David Long Reported-by: AKASHI Takahiro Signed-off-by: Will Deacon --- arch/arm64/kernel/entry.S | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index f0b5e5120a87..726b910fe6ec 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -324,7 +324,6 @@ el1_dbg: mrs x0, far_el1 mov x2, sp // struct pt_regs bl do_debug_exception - enable_dbg kernel_exit 1 el1_inv: // TODO: add support for undefined instructions in kernel mode