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=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 22FFBC433E0 for ; Tue, 30 Jun 2020 19:50:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 D9430206A1 for ; Tue, 30 Jun 2020 19:50:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rndfMuBY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9430206A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=rYgqd48eRUcRna7T9FuAei4wCZUHfFGWIUlEDiuFWPI=; b=rndfMuBY+vH2UXnjiCruon1E1f dlzHSi1HjEU1t6N5pNPs/Kr/BDgnFfzgSeHkhrQZxzowe3mrZxi1EVzDvJX9he2hmF6F9scDcAAGs 4FIO4GrCoSS4LMz4CHK3qdzEgNxznCPNynKU61BLSIW8SFhyVCuQl7Mu8HX/eZq7Dkkk9ZH7euT8p gwwNTm6GYqe5CRM4EeBEQeiz0bm11k/7W/SQQzSdYvyzuFHdShk7gDFN+6OhX/3r6SLC3qjWmNO8Y kLwo4s2AmT61qFJYpuc61fybqFmG/KavAMEv3InDzrSnLjYotFVjrNp0v69Lp9H80VguV7RWHX1A3 HQVMZd4A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqMFP-0002Oj-Kc; Tue, 30 Jun 2020 19:48:51 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqMFK-0002Mz-Cn for linux-arm-kernel@lists.infradead.org; Tue, 30 Jun 2020 19:48:47 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 925C3106F; Tue, 30 Jun 2020 12:48:45 -0700 (PDT) Received: from seattle-bionic.arm.com.Home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A45CE3F73C; Tue, 30 Jun 2020 12:48:44 -0700 (PDT) From: Oliver Swede To: Will Deacon , Catalin Marinas Subject: [PATCH v4 02/14] arm64: kprobes: Drop open-coded exception fixup Date: Tue, 30 Jun 2020 19:48:10 +0000 Message-Id: <20200630194822.1082-3-oli.swede@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200630194822.1082-1-oli.swede@arm.com> References: <20200630194822.1082-1-oli.swede@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200630_154846_528061_E27FD932 X-CRM114-Status: GOOD ( 13.66 ) 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: Robin Murphy , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Robin Murphy The short-circuit call to fixup_exception() from kprobe_fault_handler() poses a problem now that the former wants to consume the fault address too, since the common kprobes API offers us no way to pass it through. Fortunately, however, it works out to be unnecessary: - uaccess instructions themselves are not probeable, so at most we should only ever expect to take a fixable fault from the pre or post handlers. - the pre and post handler run with preemption disabled, thus for any fault they may cause, an unhandled return from kprobe_page_fault() will proceed directly to __do_kernel_fault() thanks to the faulthandler_disabled() check. - __do_kernel_fault() will immediately call fixup_exception() unless we're in an EL1 instruction abort, and if we've somehow taken one of those on what we think is the middle of a uaccess routine, then the world is already very on fire. Thus we can reasonably drop the call from kprobe_fault_handler() and leave uaccess fixups to the regular flow. Signed-off-by: Robin Murphy Signed-off-by: Oliver Swede --- arch/arm64/kernel/probes/kprobes.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index d1c95dcf1d78..771635360110 100644 --- a/arch/arm64/kernel/probes/kprobes.c +++ b/arch/arm64/kernel/probes/kprobes.c @@ -334,13 +334,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr) */ if (cur->fault_handler && cur->fault_handler(cur, regs, fsr)) return 1; - - /* - * In case the user-specified fault handler returned - * zero, try to fix up. - */ - if (fixup_exception(regs)) - return 1; } return 0; } -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel