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 0D15CC88E77 for ; Wed, 16 Sep 2026 08:04:46 +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=qi/8KmTACgzaOJUo6Ls2h+Iy6oJkE3czWFE7HPb7+BU=; b=hBIBUsFNc4bvA2oKeShp+MzwiS uokL/EnEG8UCyB2B4yQahxONIpbloomHaLuVyknubvzSN74mbeMZv6jWbPfMTyfLCiU/nk/UPa1yl b+VNePqL9AF8q7IsFRCfM06H4JridlNBTuHVHcu6geuNT+dUAdCLFSCsY7XkcnW+AoD0ED0UBp2IV bH6TTa90B/DCw/+U/8WSdVLcIn39cNjf5Jjn3i+UB/JVLMTOw97sAgfa39zdW2zVe0/a3I0KukTgE Y4Ma6LQXW5cncUIR9uv1xvEVcsy8GOtqDCBuZzocHcIBDZshpAEbQyD6eBAQxc7JSx/Ds/kU+6VEm lWw/sNiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x6kdA-00000008gCi-0GrH; Wed, 16 Sep 2026 08:04:37 +0000 Received: from canpmsgout10.his.huawei.com ([113.46.200.225]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x6kcw-00000008g7Y-29Qc for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2026 08:04:25 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=qi/8KmTACgzaOJUo6Ls2h+Iy6oJkE3czWFE7HPb7+BU=; b=4aES9vTmVc05dUs+HbF8lsBQYc+lpPG1KcvWDHRIel689opGbw1oG3uUyE1R6a4TWD5E8FWLa 4isP6jr4lO3v/fw91IodAoXjzoe8fu4BbTr93m7BNLV5Qz9G3DAdjosYUgSfhWWUNCJHJW4hzz/ 10h4vFRehaW+dxOgTpQfenI= Received: from mail.maildlp.com (unknown [172.19.163.15]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4hlB2g4Ktdz1K96s; Wed, 16 Sep 2026 15:53:15 +0800 (CST) Received: from kwepemk300012.china.huawei.com (unknown [7.202.194.175]) by mail.maildlp.com (Postfix) with ESMTPS id 6317840586; Wed, 16 Sep 2026 16:04:14 +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; Wed, 16 Sep 2026 16:04:13 +0800 From: Xie Yuanbin To: , , , , , , , , , , , , CC: , , , , , , , Yadi.hu Subject: [PATCH 5.10.y/5.15.y 3/4] ARM: ensure interrupts are enabled in __do_user_fault() Date: Wed, 16 Sep 2026 16:00:10 +0800 Message-ID: <20260916080011.170295-3-xieyuanbin1@huawei.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260916080011.170295-1-xieyuanbin1@huawei.com> References: <20260916080011.170295-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_010422_911763_FB1631E8 X-CRM114-Status: GOOD ( 14.21 ) 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)" 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) --- 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