From patchwork Thu Feb 1 15:46:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13541303 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63A58C4828F for ; Thu, 1 Feb 2024 15:46:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD67E6B008C; Thu, 1 Feb 2024 10:46:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A85F46B0092; Thu, 1 Feb 2024 10:46:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 925766B0093; Thu, 1 Feb 2024 10:46:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7BEF56B008C for ; Thu, 1 Feb 2024 10:46:40 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5A1C91608EA for ; Thu, 1 Feb 2024 15:46:40 +0000 (UTC) X-FDA: 81743662560.30.82A71F9 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by imf25.hostedemail.com (Postfix) with ESMTP id 219A5A0007 for ; Thu, 1 Feb 2024 15:46:36 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=flygoat.com header.s=fm1 header.b=ogNS4GpH; dkim=pass header.d=messagingengine.com header.s=fm3 header.b="Z v7vFK8"; dmarc=pass (policy=none) header.from=flygoat.com; spf=pass (imf25.hostedemail.com: domain of jiaxun.yang@flygoat.com designates 66.111.4.25 as permitted sender) smtp.mailfrom=jiaxun.yang@flygoat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706802397; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PkffIQ/TwdfU+2w1YXK1H3DJt1XQppKKQHpkyIAY8Jw=; b=iaBxu/pkasJdSPe6iMuO8HatnteOKXzF0rxSQ2C8dASZa4Ry7F3LqrTkvZ2iGo99ZrF9Yu v/htTChaCvTUEcF1DoDRh4D4ttmG/PCrKmA8prICalKbrfuiKBD7AIGDfA43bEETHEG6Zw P1D66DwrnqrHAXufchTXkHRj8sWP78g= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=flygoat.com header.s=fm1 header.b=ogNS4GpH; dkim=pass header.d=messagingengine.com header.s=fm3 header.b="Z v7vFK8"; dmarc=pass (policy=none) header.from=flygoat.com; spf=pass (imf25.hostedemail.com: domain of jiaxun.yang@flygoat.com designates 66.111.4.25 as permitted sender) smtp.mailfrom=jiaxun.yang@flygoat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706802397; a=rsa-sha256; cv=none; b=7Ei/dzqbkt53Ut15zCLcEUDmceuiSQQyjdGXFBR925UyjiTpKCCbXR0XD7jQdi6qU+iD1P udZ6gKXqAisCbnGZdlW8R/d6aLPdhJgskaYkFA6vLURPIlAvzRJk1629mhJFDLR3MYP3hM tH8LF4C/1Yu2SsITO208UnTsfHfB7b8= Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 751975C0143; Thu, 1 Feb 2024 10:46:36 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 01 Feb 2024 10:46:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1706802396; x=1706888796; bh=PkffIQ/TwdfU+2w1YXK1H3DJt1XQppKKQHpkyIAY8Jw=; b= ogNS4GpHLOaAi26YwvNGDn2O/lkVyJMCKH4ZLzdYBxvNF4Ghg+1pAS7N+7fe3PEQ F7U03j5yLZfBYr9bPyahFksuvY7GaYExKi0iBKAc8Hk6GqnizcaCLXyAFLCCEpXC AAX9DKxr/ZwxJ/FdNGr01oFM0sW6gRIyxhTkq99EulTm4pDloXDVGC1l89ZwZMfa F0CbBoftKcYqOXwCkLZwhPJ644yqZJelFRqgAxGz/uHR3IC9AFTai5ARHwqX/O6I u8HtBisIX2VLfLBtkDclhJkOx4RmpCqYQdmcoDHGINyWL/BIRP/bp98GL9AcfQmL IZvC9hNk77GCvSkpwET2KQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1706802396; x= 1706888796; bh=PkffIQ/TwdfU+2w1YXK1H3DJt1XQppKKQHpkyIAY8Jw=; b=Z v7vFK8h6WyGCZO+fTEtv3JQhFyhoWTvILxwV2NRWBdSK1vdjFMCVXW2GwTXx/GZZ XBQSt1aqtTonHlvkFoOhTh6d+by+aReRfLMNARK8312ZdUbnzZyEGAOBjRIBuxU4 85NXS0HATkVvRpxYb1G0zp3NZ3ADGDRYaccdGeb+vffRs93pvjIqx6nUiTt1D8ny mGqzioXUePtDNS6HeWHnuUFkgFl6gJVgZVx4Xm2hSgDAQ73Bo/964MVd2/gTVo4Y FZD/yYJhMTAISTPGoUIid5krD4B4xst1ENOGPHMZ4I/j+rCYGPriAtVs9JD3RGG5 /I4/Hl8vvbpBKYCMxpSRA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfeduuddgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvedujefhfffhveekhfffkeetvefgteejkeeutdduieehieeg feejtdelveejtedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhg sehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Feb 2024 10:46:34 -0500 (EST) From: Jiaxun Yang Date: Thu, 01 Feb 2024 15:46:29 +0000 Subject: [PATCH 3/3] mm/memory: Use exception ip to search exception tables MIME-Version: 1.0 Message-Id: <20240201-exception_ip-v1-3-aa26ab3ee0b5@flygoat.com> References: <20240201-exception_ip-v1-0-aa26ab3ee0b5@flygoat.com> In-Reply-To: <20240201-exception_ip-v1-0-aa26ab3ee0b5@flygoat.com> To: Oleg Nesterov , Thomas Bogendoerfer , Andrew Morton , Ben Hutchings Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, Jiaxun Yang , Xi Ruoyao , Linus Torvalds X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1379; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=uKuLCoMYm7TN/5FDEmNqhpyC6JKJvRlQkX2qQKN8ZTg=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhtTde672x4SsrfVewuR6t1Nnmlr5QtH+q/m1zqculPqee +n7amJERykLgxgXg6yYIkuIgFLfhsaLC64/yPoDM4eVCWQIAxenAEyk2oHhn8q3ba8O6dkcYv32 cfqJCbVLm8pE31xT/LY88sIrTq7Li2cw/Pdfnj5VT79IOtfx81mrjQXq64WdoqsvPp4d/UHlQPI XQx4A X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 219A5A0007 X-Stat-Signature: sgy8ur54npibgmzdshst9we1b7a8pbxg X-Rspam-User: X-HE-Tag: 1706802396-21714 X-HE-Meta: U2FsdGVkX189r6np4oFKu9kXQhdYk8T09nTU+EmPNh8EbAd724sGiY2yqkdYmXe1AMoxoXcKJuPuwWGGNJWPrqwuIMPMZTo03L8kbMfGdBA968tpDsHALM6/WToZxkNBKh955Aribpc+zf1NKdrj9izH+MtEFQE4C/l7bLdgCXCzwzOMV7loOdX02HT0XDKcmvIi0xJYeK4Wohip9LoQ5iRfxS0IurzSyLwElNTEFIDc/Z/ymDh16hYZmxyi9Nkgns0GJNAFN+6CYQWXs+qknPl3jpGpnwNUz8gkn/cjiVwpCSrzAhviJVcrrutf10nLdHs/yQil0nw/1gQPWib3Vn/7j6rZAipEiGJQ+pE4cHrrCyCHJslscPVusPYzD0OFzv7Hyxa5aiFeLmwMkPoGoZs+9JNyJDwR4QKTLDvkllpnNkNDpF2YBfVx+WQkMYFrQ+KKGY+je3vpUxSK7Zl1VkHwpCovhc1DoY2lQSDSMk1ZJGv+0kIwRdnd3lskE6Dz7395S/0a1lW3Ean/OPlYtD2vxKzwzTDt1TxgZxFpCDOVag/5wUCttH+WSwkd/SovNEE1hM2XNm+9skflsrqfADWKZ500qwXJRm6BCe147Sj+MIZoRMxk86u1+bT4Iog+4YDdKNLgxDYSZUMVLk346Dkwsp6pHRZArfENQoBHm+CcIyhcHS9vHT/eSE6/E56Qpp8/sdp4O1ugODkGVKMpiQ31ZJ0yoFmdtnpnwUagnheV7acN3Fo4f8JSf+0Nx2Uq26RHmpePWhHv9bmVaWpp4INOaoM1YENeJ02mV5qWEF1wp2y29CR7vj56gXsXcsYYFXbLiIjQUT8A/kU5OGtFmFC4vgyhZdfRmJ7Qaco+h0YaZ9ngyvnc4hliibioo3X5r/K0puNDhqUi45+g7FpKkskCu0PJ0YLw0szoS/l1VQvFDasxjDCVgNhGxbG2euKOaXi4BeZEaDpfWl0/KLM ODKA53k0 Xke05MX7FbSfQd2Z4+nohF3EuXvqJ1F1qMrIh5KAkqil+NDBf/1kwbNGtFZNpYOciyY6d0JZ5InDGVhwYzRl3BkmtXba+b1jof3X6Dvr795A5ud8DkMSzttkBLN/LL/HVXrbSDLdCHb9JgIVkc/Ws/VeIeYkjriB01d75RKS8ohTLDNjKo6vUzdimpqN19TspTxn25UaLHVuFHuDmMIlygqwo/e/eUMk2EeNHuF6O2ednoNrWxpvoKxp70HWCXCEnk5dxXomGGypH4Io8q0KEPqM1z27MmuPtv+se/4hjMs6hnhCnUMyBU9ZwArRgUyAd6OjAnxhWwdJSRZtUo5Q4tvfG/R+OHJ0Gn1U/dfGbuSGgwUDtCLwj4QeWxRsWLEy9NjLlokr+1xbuHggnKOBQhGaMnHO6TizPfqR6npWLpFQ3VBLaDr2PUxG/zuC5rl/q5/3G X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On architectures with delay slot, instruction_pointer() may differ from where exception was triggered. Use exception_ip we just introduced to search exception tables to get rid of the problem. Fixes: 4bce37a68ff8 ("mips/mm: Convert to using lock_mm_and_find_vma()") Reported-by: Xi Ruoyao Link: https://lore.kernel.org/r/75e9fd7b08562ad9b456a5bdaacb7cc220311cc9.camel@xry111.site/ Suggested-by: Linus Torvalds Signed-off-by: Jiaxun Yang --- mm/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 8d14ba440929..49433612444a 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5481,7 +5481,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs return true; if (regs && !user_mode(regs)) { - unsigned long ip = instruction_pointer(regs); + unsigned long ip = exception_ip(regs); if (!search_exception_tables(ip)) return false; } @@ -5506,7 +5506,7 @@ static inline bool upgrade_mmap_lock_carefully(struct mm_struct *mm, struct pt_r { mmap_read_unlock(mm); if (regs && !user_mode(regs)) { - unsigned long ip = instruction_pointer(regs); + unsigned long ip = exception_ip(regs); if (!search_exception_tables(ip)) return false; }