From patchwork Tue Jan 4 21:34:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 12703849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D2CCC4332F for ; Tue, 4 Jan 2022 21:34:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233487AbiADVet (ORCPT ); Tue, 4 Jan 2022 16:34:49 -0500 Received: from mta-mtl-002.bell.net ([209.71.208.12]:36700 "EHLO cmx-mtlrgo001.bell.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234136AbiADVes (ORCPT ); Tue, 4 Jan 2022 16:34:48 -0500 X-RG-CM-BuS: 0 X-RG-CM-SC: 0 X-RG-CM: Clean X-Originating-IP: [67.71.8.137] X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 61CE3D3B005F41AC X-CM-Envelope: MS4xfFnHH+Eb1Fe5jI+p3RjaPZUE0K1gh44cA1YpLl2cJQh6O+mggOcW4wMeFotcR7wM0md8nyIcda2q9zL4XRRqOa6Wm/EUVXlRDVIlAcDZOsCKBJ1SnLgO WXUPb+Qzp9CBUSnjxeYqYXQYZ/HMLNU8QQjIkmpgzj9hfuEXJfRS9qi8CUVLQQdzESDJyFQpK6aSN1oopLKr8bK9TTP6KtL/BqC8KPszb8jq9cd45skS/ARn 8A9F7v/o73NFFP/Bz2w33JO4nnJw6GvfiDMeZ4VpMCZLyhP/915CaNTqUshu2KbxebTLqOcmo3r4qvQoEnJGh3Vm8xEwtV2kNTzNepzCyR6N+hGYUORmzUKZ vVhRQjxPL8byJn8LL0sdnkXuNuq25whwk9TG0GYQBTP7AFbJ9isS6TOm0uWcJfl28MSnU2HAAfUu3G34mtbE482QfGFR69O+e2/APPTjo5eg7fO8B47wi5Xg duTvqbAmBQn7/RGsVO+hxpy1zPsZPkaSYGjCZ7RhkEyEPyQQQSaGfb+p/SU9bWJOUzU9d5l1NUlnvxnoLAEvNOpB1YJwtVqX/bqqZD3FNFGtxafneIcbmgRB mWEX6Y+myPCh3DmuBplLVoRdssleCq7GcC6ydDiWFGX7EQ== X-CM-Analysis: v=2.4 cv=eZxew5IH c=1 sm=1 tr=0 ts=61d4bd64 a=jrdA9tB8yuRqUzQ1EpSZjA==:117 a=jrdA9tB8yuRqUzQ1EpSZjA==:17 a=DghFqjY3_ZEA:10 a=FBHGMhGWAAAA:8 a=TLObkWdysBXqFXURvToA:9 a=CjuIK1q_8ugA:10 a=PySCXoWds3VBT8ULBo4A:9 a=FfaGCDsud1wA:10 a=9gvnlMMaQFpL9xblJ6ne:22 Received: from mx3210.localdomain (67.71.8.137) by cmx-mtlrgo001.bell.net (5.8.716.03) (authenticated as dave.anglin@bell.net) id 61CE3D3B005F41AC; Tue, 4 Jan 2022 16:34:28 -0500 Received: by mx3210.localdomain (Postfix, from userid 1000) id E2636220117; Tue, 4 Jan 2022 21:34:26 +0000 (UTC) Date: Tue, 4 Jan 2022 21:34:26 +0000 From: John David Anglin To: linux-parisc Cc: Helge Deller , Deller , James Bottomley Subject: [PATCH] parisc: Don't call faulthandler_disabled() in do_page_fault() Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org It is dangerous to call faulthandler_disabled() when user_mode(regs) is true. The task pagefault_disabled counter is racy and it is not updated atomically on parisc. As a result, calling faulthandler_disabled() may cause erroneous termination. We now handle execption fixups and termination when user_mode(regs) is false in handle_interruption(). Thus, we can just remove the faulthandler_disabled() check from do_page_fault(). faulthandler_disabled() Signed-off-by: John David Anglin diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 01fd2a32acc6..499e2e8f7f34 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -267,9 +267,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, vm_fault_t fault = 0; unsigned int flags; - if (faulthandler_disabled()) - goto no_context; - tsk = current; mm = tsk->mm; if (!mm)