Message ID | 20240201-exception_ip-v1-3-aa26ab3ee0b5@flygoat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-48435-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp252345dyb; Thu, 1 Feb 2024 07:59:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYO5FYO0jvXSikSjA1C+CGBkQU7NKA+9MGZq0zUavFJonKVJh1MyjM9ZrJ5TeNwr207HCH X-Received: by 2002:a17:90b:30c1:b0:296:3240:470d with SMTP id hi1-20020a17090b30c100b002963240470dmr103982pjb.6.1706803190754; Thu, 01 Feb 2024 07:59:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706803190; cv=pass; d=google.com; s=arc-20160816; b=p6lNTn31BW646ygM+rHPPbM87ONN9DsSSufbv97D3Yxn6aVFR4o80VfvefjGSibNEI erj+XuCWV4hNUErtkzIjufYHKWj/Ftj1MSg1ijJ82IAMU2nJRYSV4LtRwuU4TBrhWNp/ AYzRsg9kTlderhtZIuBqP7atc9S9ACIkidh7zvlB4gn35wSxfI3L+xVahv2tR9Ze0J57 JmdeKD2J1gkvBhKOpujSZk4YTyKJaYQpNucUwDK0fqxP9UtzP11heeVpmF8TcBA6+D1Z fUvw9Oqh7f0RPinaKHzD7QTJdLkGH78XvhP4dzudotwzpD5Mk0ioaEO7Ao1wXEUbEaAW yOZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:feedback-id:dkim-signature:dkim-signature; bh=PkffIQ/TwdfU+2w1YXK1H3DJt1XQppKKQHpkyIAY8Jw=; fh=3l0xhk4kUdVtabXy41CVWUuZ8ezhjQ95fICEylwALwM=; b=Q7wN8PFhTx2hVza1itozhx4mkscU5EO079kHlfgx5kUnHzXKo0oewnjBeknuTn8Bsf 41wcFEXZZHZQuHmued0gQ5xrJZi/B3kutBLdDHyio53QM+sCQFBZ9JDTqFQUbfqIDWDv v0KKMvPWHruayupR/WGDrCbBN9qBR6C/s4BgsHURClBUy+6wfa4Iy2lJ2MZYGJE9xDTB rpNGxqJg2+LpARvJI9f/Kjd7jci7XXXgyarDepel6U5mDbMdzTrt2niLUUeOVk+g34ih 3WnyUi3+cvLzo50Z9yQE1vXYFzSshL0TrJchxzOcb3dSkrUVM2a5ISidQUrQQh9xBqL4 hKSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=ogNS4GpH; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Zv7vFK8h; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-48435-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48435-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com X-Forwarded-Encrypted: i=1; AJvYcCW4k9G5+YRt0T38XayCEZISoKt1EIo118S2XXpWckfZRXa0+PkPsWFsgwUXdAbm+FCP/CHTMaEJRXds2lieiS/m4ao6MA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w6-20020a17090a1b8600b00295d9ec8e60si3842624pjc.123.2024.02.01.07.59.50 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 07:59:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48435-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=ogNS4GpH; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Zv7vFK8h; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-48435-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48435-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 51C332997D8 for <ouuuleilei@gmail.com>; Thu, 1 Feb 2024 15:47:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99A9415D5BA; Thu, 1 Feb 2024 15:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="ogNS4GpH"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Zv7vFK8h" Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7509B779F0; Thu, 1 Feb 2024 15:46:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706802399; cv=none; b=fJuAwlEkqOBb6YIzF51rrkpYw7r9xTxbO5iDAyXk6JL2gxVhsLN8VUoNPlEgMYdnZ72jQHRUBZ6tF5vA7i6+otdzZkGRZLTZRW5R0ucbVdfVHkGBfG9VjxpIt25dPH10jMcy5Aub//gf+ZGWqPJrHOZPOGDwlwEQ8a9mraCaHXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706802399; c=relaxed/simple; bh=uKuLCoMYm7TN/5FDEmNqhpyC6JKJvRlQkX2qQKN8ZTg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MIhRhE0FoY2P+q9zLoHm2mLv2bgHHhQffd2ZYNp+9ENU4LIYdc8IBaCvB9hDXXtmOfqL9BtBx1YubaeEuWfsMEwEeCxQ9fAtiYT/d+N+VPltNDdP8tHKo9th1SDjcCivFksJ30to78rKq4Q09vXNlzYMMQQ9fXK42dcXLUbLee4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=ogNS4GpH; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Zv7vFK8h; arc=none smtp.client-ip=66.111.4.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com 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: <xms:3Ly7ZegrwF-HGZ-4D3_2DchrRtSBqLg8IdG3M4oYhlU6jNcAHxPHpA> <xme:3Ly7ZfA9G16qXg6zutH4IVp_3COSyhS4eGQpcU2dqVDLL185fjRdyZYkwwx6fz9q9 bEPsj8Q49i6aTFshCI> X-ME-Received: <xmr:3Ly7ZWFX37urArgNuBeig6_wHReDpa64NJX_UOR1Ow2_m7knqA2Fez1MU7FwlpJ2GOKy_cOmghz8Tr8XCRF5QFiYkg> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfeduuddgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvedujefhfffhveekhfffkeetvefgteejkeeutdduieehieeg feejtdelveejtedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhg sehflhihghhorghtrdgtohhm X-ME-Proxy: <xmx:3Ly7ZXTG6JY7EqV_vQHpNTdn8JAWolp4FpWaS0BwBoYuALnLhDL1IA> <xmx:3Ly7Zbx7nCr0e0h_WMXgSs__cM2lDlHnHbfWedr3XO33Pwhh71QAhw> <xmx:3Ly7ZV4zAlY1TuSm84sx_hlSG-A2k-VHIfJbdE3Ukkk3Oj4pMSOFUA> <xmx:3Ly7ZTdsTKza5t_N_SYFom1zppPyDQto2lhv-P1gCKTa4jBo1b9-bg> Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Feb 2024 10:46:34 -0500 (EST) From: Jiaxun Yang <jiaxun.yang@flygoat.com> Date: Thu, 01 Feb 2024 15:46:29 +0000 Subject: [PATCH 3/3] mm/memory: Use exception ip to search exception tables Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 <oleg@redhat.com>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>, Andrew Morton <akpm@linux-foundation.org>, Ben Hutchings <ben@decadent.org.uk> Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, Jiaxun Yang <jiaxun.yang@flygoat.com>, Xi Ruoyao <xry111@xry111.site>, Linus Torvalds <torvalds@linux-foundation.org> 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789712862198170301 X-GMAIL-MSGID: 1789712862198170301 |
Series |
Handle delay slot for extable lookup
|
|
Commit Message
Jiaxun Yang
Feb. 1, 2024, 3:46 p.m. UTC
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 <xry111@xry111.site>
Link: https://lore.kernel.org/r/75e9fd7b08562ad9b456a5bdaacb7cc220311cc9.camel@xry111.site/
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
mm/memory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
Hi Jiaxun, kernel test robot noticed the following build errors: [auto build test ERROR on 06f658aadff0e483ee4f807b0b46c9e5cba62bfa] url: https://github.com/intel-lab-lkp/linux/commits/Jiaxun-Yang/ptrace-Introduce-exception_ip-arch-hook/20240201-234906 base: 06f658aadff0e483ee4f807b0b46c9e5cba62bfa patch link: https://lore.kernel.org/r/20240201-exception_ip-v1-3-aa26ab3ee0b5%40flygoat.com patch subject: [PATCH 3/3] mm/memory: Use exception ip to search exception tables config: i386-buildonly-randconfig-002-20240203 (https://download.01.org/0day-ci/archive/20240203/202402032150.DmM8VjRz-lkp@intel.com/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/202402032150.DmM8VjRz-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202402032150.DmM8VjRz-lkp@intel.com/ All errors (new ones prefixed by >>): mm/memory.c: In function 'get_mmap_lock_carefully': >> mm/memory.c:5484:22: error: implicit declaration of function 'exception_ip' [-Werror=implicit-function-declaration] unsigned long ip = exception_ip(regs); ^~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/exception_ip +5484 mm/memory.c 5477 5478 static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs *regs) 5479 { 5480 if (likely(mmap_read_trylock(mm))) 5481 return true; 5482 5483 if (regs && !user_mode(regs)) { > 5484 unsigned long ip = exception_ip(regs); 5485 if (!search_exception_tables(ip)) 5486 return false; 5487 } 5488 5489 return !mmap_read_lock_killable(mm); 5490 } 5491
Hi Jiaxun, kernel test robot noticed the following build errors: [auto build test ERROR on 06f658aadff0e483ee4f807b0b46c9e5cba62bfa] url: https://github.com/intel-lab-lkp/linux/commits/Jiaxun-Yang/ptrace-Introduce-exception_ip-arch-hook/20240201-234906 base: 06f658aadff0e483ee4f807b0b46c9e5cba62bfa patch link: https://lore.kernel.org/r/20240201-exception_ip-v1-3-aa26ab3ee0b5%40flygoat.com patch subject: [PATCH 3/3] mm/memory: Use exception ip to search exception tables config: arm64-randconfig-001-20240203 (https://download.01.org/0day-ci/archive/20240203/202402032112.NBimLx5h-lkp@intel.com/config) compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/202402032112.NBimLx5h-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202402032112.NBimLx5h-lkp@intel.com/ All errors (new ones prefixed by >>): >> mm/memory.c:5484:22: error: call to undeclared function 'exception_ip'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] unsigned long ip = exception_ip(regs); ^ mm/memory.c:5509:22: error: call to undeclared function 'exception_ip'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] unsigned long ip = exception_ip(regs); ^ 2 errors generated. vim +/exception_ip +5484 mm/memory.c 5477 5478 static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs *regs) 5479 { 5480 if (likely(mmap_read_trylock(mm))) 5481 return true; 5482 5483 if (regs && !user_mode(regs)) { > 5484 unsigned long ip = exception_ip(regs); 5485 if (!search_exception_tables(ip)) 5486 return false; 5487 } 5488 5489 return !mmap_read_lock_killable(mm); 5490 } 5491
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; }