From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0BD2C54E4B for ; Tue, 12 May 2020 07:36:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4B26206B7 for ; Tue, 12 May 2020 07:36:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gXYEqw7e"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="t5R7cSJl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4B26206B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sLQYfZ0+sVrFAfiCBTK663qt2UlqZRu2DwkWBJ621Ws=; b=gXYEqw7eGDKkuE f1EVyajRFaeVB/GYC8e4KFzu6Q/7YZXTP1rOFhNtSIa4EqsSLiOItkD1RHsEMvVRr5jML9FFI+giY w7Rtz7j8Ge0blrZCo9HDPIyy9dMAlRR/q6+mHgnbw9Cthj52Sak0ERBD3kopYLuaHlv/SWnC1+Zmn cROFubOQqOTRdLEqHjP7UQ5hBTna5IyJ1gV/rmvwlkIeACAvxtKMH7DC59PnaytBxz3AN/H6cvjLw sBEm/3iKnG/B+nvqU4Mq+brgtSnyBIO4yz4QcSzEVe9+sDrSozU3UWp3pxkkxc3rPxSWFnCDy7yh3 JBs+9iANU+fOSUFJf2Sg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYPTB-0001oR-6S; Tue, 12 May 2020 07:36:53 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYPSM-00015I-VD for linux-arm-kernel@lists.infradead.org; Tue, 12 May 2020 07:36:05 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (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 B5F32206B7; Tue, 12 May 2020 07:35:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589268960; bh=mwdUCDRsQcd4tBUSrGY2SY7Tr80S7IIqcEq7gM+QFyo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=t5R7cSJlDsOP/Rq15vISPrYY6nRgt0EcIH9XTuDyRC2GPJ6DWnRnmhKdfTiy4a30Y VJDL7O2w+OjJd6KbOlyAT9++Kn8lwIjNjkC+57eIGAzvYLg5+3SymfzalRlvTKRmLj Akz/XtkhIvyCU63jhozKZ3BdSOgowTXCmGBDg64I= Date: Tue, 12 May 2020 08:35:53 +0100 From: Will Deacon To: Doug Anderson Subject: Re: [PATCH v3 05/11] arm64: Add call_break_hook() to early_brk64() for early kgdb Message-ID: <20200512073552.GA1538@willie-the-truck> References: <20200428211351.85055-1-dianders@chromium.org> <20200428141218.v3.5.I22067ad43e77ddfd4b64c2d49030628480f9e8d9@changeid> <20200511145908.GA22040@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200512_003603_096496_15D447FE X-CRM114-Status: GOOD ( 19.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Catalin Marinas , Bjorn Andersson , "H. Peter Anvin" , Frank Rowand , Daniel Thompson , Jonathan Corbet , jinho lim , Andy Gross , Linux ARM , linux-serial@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, Dave Martin , Masami Hiramatsu , Jiri Slaby , Alexios Zavras , bp@alien8.de, Thomas Gleixner , Ingo Molnar , Allison Randal , Sumit Garg , Greg Kroah-Hartman , LKML , James Morse , "Eric W. Biederman" , Jason Wessel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, May 11, 2020 at 03:45:02PM -0700, Doug Anderson wrote: > On Mon, May 11, 2020 at 7:59 AM Will Deacon wrote: > > On Tue, Apr 28, 2020 at 02:13:45PM -0700, Douglas Anderson wrote: > > > diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c > > > index 48222a4760c2..59c353dfc8e9 100644 > > > --- a/arch/arm64/kernel/debug-monitors.c > > > +++ b/arch/arm64/kernel/debug-monitors.c > > > @@ -297,7 +297,7 @@ void unregister_kernel_break_hook(struct break_hook *hook) > > > unregister_debug_hook(&hook->node); > > > } > > > > > > -static int call_break_hook(struct pt_regs *regs, unsigned int esr) > > > +int call_break_hook(struct pt_regs *regs, unsigned int esr) > > > { > > > struct break_hook *hook; > > > struct list_head *list; > > > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c > > > index cf402be5c573..a8173f0c1774 100644 > > > --- a/arch/arm64/kernel/traps.c > > > +++ b/arch/arm64/kernel/traps.c > > > @@ -1044,6 +1044,9 @@ int __init early_brk64(unsigned long addr, unsigned int esr, > > > if ((comment & ~KASAN_BRK_MASK) == KASAN_BRK_IMM) > > > return kasan_handler(regs, esr) != DBG_HOOK_HANDLED; > > > #endif > > > + if (call_break_hook(regs, esr) == DBG_HOOK_HANDLED) > > > + return 0; > > > > I think this just means we're not running debug_traps_init() early enough, > > and actually the KASAN early handler is unnecessary too. > > > > If we call debug_traps_init() directly from setup_arch() and drop the > > arch_initcall(), can we then drop early_brk64 entirely? > > It seems to work in my testing. ...but the worry I have is the > comment right before trap_init(). It says: > > /* This registration must happen early, before debug_traps_init(). */ I /think/ the reason for this is because debug_traps_init() replaces the BRK vector, so if that runs before the break hooks have been registered for e.g. BUG() then BUG() won't work during that window. Hmm, so dropping early_brk64 is problematic after all. Damn. Is trap_init() early enough for you? If so, we could call debug_traps_init() from traps_init() after registering the break hooks. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel