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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EADD0C982CC for ; Thu, 17 Sep 2026 02:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PSrGRkSIHQGbxbe4Ft5AX7hBVqF+BpQDdBUjrKmwX5s=; b=RxNQOGFXnCDhNN5h1nmt+Rm/Yp EUaJxDhadKeuIR6gngUMLTnJaNG0vuF0jodJhfIti3UX8REsJ3JuWChIR6y1A+3/PTpm7RW7GXP7y I8DoxXb+ojeRzDXaPG94CwOtut32Tjt2VGxL1R21gEW90/AtmnkOR4OWU+lNClOfGPtjRimOL1fH7 VnneDLHnKEXtYuYXBFMNbtWjSnSW/VL8yqF/7XcpQ7l9U9ufOqRQ5CIWTkuKyyuaoxAGmSHi5l6a6 Lu21f/yXC4XA0I7sDFt85hX2z8VlMmd2BqAosnokYY1N3p4T5AL5Lhok7Zdst2vtPgtyecRuD4Ixz FSh6UfkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x71uT-0000000AT5X-0Y9B; Thu, 17 Sep 2026 02:31:37 +0000 Received: from canpmsgout06.his.huawei.com ([113.46.200.221]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x71uL-0000000AT0V-0GXy for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2026 02:31:31 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=PSrGRkSIHQGbxbe4Ft5AX7hBVqF+BpQDdBUjrKmwX5s=; b=Lw4b3BNUoNrvWcO4mMH//REihHJ177IA8d81vu5Sj3j1X2WixptbbQHCrj8+zeGCnaj+d5O1y emeT4FORq7VkEvtIlYXmCuLRs8lJ0svgQMD3vRg8jj/zcCfibaweOAbIr4//1WOfOdoSha7Mn0c bD97coYSyTqsL8J8Ei6IY3A= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout06.his.huawei.com (SkyGuard) with ESMTPS id 4hlfc62V9ZzRhQs; Thu, 17 Sep 2026 10:20:22 +0800 (CST) Received: from kwepemk300012.china.huawei.com (unknown [7.202.194.175]) by mail.maildlp.com (Postfix) with ESMTPS id 00E964057D; Thu, 17 Sep 2026 10:31:19 +0800 (CST) Received: from DESKTOP-A37P9LK.huawei.com (10.67.109.17) by kwepemk300012.china.huawei.com (7.202.194.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Thu, 17 Sep 2026 10:31:18 +0800 From: Xie Yuanbin To: , , , , , , , , , , , , CC: , , , , , , , Yadi.hu , Xie Yuanbin Subject: [PATCH v2 5.10.y/5.15.y 3/3] ARM: ensure interrupts are enabled in __do_user_fault() Date: Thu, 17 Sep 2026 10:30:56 +0800 Message-ID: <20260917023056.2280-4-xieyuanbin1@huawei.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917023056.2280-1-xieyuanbin1@huawei.com> References: <20260917023056.2280-1-xieyuanbin1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.109.17] X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemk300012.china.huawei.com (7.202.194.175) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260916_193129_474172_3344C40D X-CRM114-Status: GOOD ( 14.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Russell King (Oracle)" [ Upstream commit 59e4f3b45b96a24fc9b7a89e5f8a2168b30f95af ] __do_user_fault() may be called from fault handling paths where the interrupts are enabled or disabled. E.g. do_page_fault() calls this with interrupts enabled, whereas do_sect_fault()->do_bad_area() will call this with interrupts disabled. Since this is a userspace fault, we know that interrupts were enabled in the parent context, so call local_irq_enable() here to give a consistent interrupt state. This is necessary for force_sig_info() when PREEMPT_RT is enabled. Reported-by: Yadi.hu Reviewed-by: Sebastian Andrzej Siewior Signed-off-by: Russell King (Oracle) Signed-off-by: Xie Yuanbin --- arch/arm/mm/fault.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 4afb076383a8..8b31d7704626 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -137,7 +137,8 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, /* * Something tried to access memory that isn't in our memory map.. - * User mode accesses just cause a SIGSEGV + * User mode accesses just cause a SIGSEGV. Ensure interrupts are enabled + * for preempt RT. */ static void __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig, @@ -145,6 +146,8 @@ __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig, { struct task_struct *tsk = current; + local_irq_enable(); + #ifdef CONFIG_DEBUG_USER if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) || ((user_debug & UDBG_BUS) && (sig == SIGBUS))) { @@ -254,6 +257,7 @@ do_kernel_address_page_fault(struct mm_struct *mm, unsigned long addr, * should not be faulting in kernel space, which includes the * vector/khelper page. Handle the branch predictor hardening * while interrupts are still disabled, then send a SIGSEGV. + * Note that __do_user_fault() will enable interrupts. */ harden_branch_predictor(); __do_user_fault(addr, fsr, SIGSEGV, SEGV_MAPERR, regs); -- 2.55.0