From patchwork Fri Feb 2 12:30:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 195847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp395905dyc; Fri, 2 Feb 2024 04:38:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFugy1MmJZLYrgaDH4T67hHcWVK+rvkw2W0KCAoqRGX2Cfw2cyDJRFxXg662FjkKAEh1f6 X-Received: by 2002:a05:6359:4286:b0:178:7701:2860 with SMTP id kp6-20020a056359428600b0017877012860mr7854164rwb.14.1706877488295; Fri, 02 Feb 2024 04:38:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706877488; cv=pass; d=google.com; s=arc-20160816; b=vCU+EB6BaXcwC3I+RyzNBdjFgt4BB3G8sFNvZBe0Fqh7iwmTf+jXeOddQNmTYc+jLi JMeJ8MQIqk1PXpnl1ugsuq6GaN/DmK03B6mmkrI3azqzqaMT6TSseQtKuT5ko9gbOV0L x0CIE0aBY8O0g5hP3dG3oKmtmv6ZJbOhadjjegw2ajKo3Re+YbffwhE7jbfCqG8Rv3yx is4npleowwdLxEkp/b5cpRekoZyEZPnrzjLnao5lODi2ntfD+XQRS9RAcufq/a1yDFZ1 sVDwGlWcQkQJY7k+4pRIesEDMyJVUpezu7LCVA9g9rwfgE9XGI1EIXeUYB1HHayP+BCW S9pg== 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=3C5bFwJv9LWEX7uXH9OhbPn6aVzr7qyWAUolJmL7emQ=; fh=YtxGIx721e8DAqLlj+dEpw9T0Z1r5p82RKY0rtnqfTQ=; b=0NBdBSW2z+hyzAy2v7t51Jv6tlskOZww9+DsM/h+UG7jJZTaf8v1UgR0Icz7VRJWHe lCBec/c8GLVNkLM8e6f2PcDV2vtPxAFK2jptfPcXLqA9WNJvM6lp1eJCWxs/z+rsAsam fBPf59A1zsJZnv+ohftpReGWFV5sY5bTtLHHfE/gVslCNa72MYsgcKc3YrhhpzYSalru 659kE6xNh4IwG3JKKu2hAgSkXHxohjtPCUnySjkm1A4t0+p62NL3tfGuR6b24rRbYq7Z r0VAg7drGaaIyKs1/Z3R5W2grjn4zMmjF2ho5U5sq+Sr13LlRw9EE66dpf2bLugfD3A1 OCDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b="fEI1zv/+"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=GM6TVMHq; 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-49843-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49843-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com X-Forwarded-Encrypted: i=1; AJvYcCUn+CUvAgRIT4C5SHDkirpBjtZ1lDsXyMjE//0f5cCM4mU1ZLBPkbacRdvFsCUCxkrNReeofWyycetugVEchQAIlVlw1w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c21-20020a634e15000000b005dbf22da5e9si1546320pgb.470.2024.02.02.04.38.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 04:38:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49843-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="fEI1zv/+"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=GM6TVMHq; 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-49843-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49843-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 A212C29737F for ; Fri, 2 Feb 2024 12:32:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E99D11FAB; Fri, 2 Feb 2024 12:30:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="fEI1zv/+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GM6TVMHq" Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (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 B657414532C; Fri, 2 Feb 2024 12:30:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.28 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706877044; cv=none; b=LDBidOcqXhwFocE7HosHPNWveLNzX2VGkS48U0HphDDgwTau7znFEbpjTmpgV1JQCUYqiNorVxlS6kpJABpwJeJEPvxp+DtW8DnfIGKSDI7dCQ7BgZpYZeQkR1SrBKprGePUUcYreQZrj+/C168rgmxzkIFOJ0aBonLx598OUHA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706877044; c=relaxed/simple; bh=jqYI8HbcM9CNa56K9MGaAYkP5szfqvwINyuXO+HntBI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bep3NYGnGTkljyORjsGCDC5Y2vdpfJKhJRj7uEXwAgIZMIgWIzEYPFXSznwb5E7lhRQm+Yq0j6Nvef+Sj3K+G6N7DJA9o886z/giusQ/ioJsVZBJR3O9zjkSV/sRr/nEVGsFwzn7D+ZOghHZshtJxhzgvN0fzPUuTHnavD4VqB4= 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=fEI1zv/+; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=GM6TVMHq; arc=none smtp.client-ip=66.111.4.28 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 compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8CDF65C0160; Fri, 2 Feb 2024 07:30:36 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 02 Feb 2024 07:30: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=1706877036; x=1706963436; bh=3C5bFwJv9LWEX7uXH9OhbPn6aVzr7qyWAUolJmL7emQ=; b= fEI1zv/+ZvFpkfpFRiLTSbFcBisWuJ2q1jjScOxUaTFUrgkBaxR7Dx3eZf25cfK3 CCgcfDN0Mp+DmtIBGMvaBhPgFah6cUtlcaagGHlj97CLyV1V3p/5jw7OtwdFh64a HMQa5y/m/fAdJjMEvV/Q0eZ89mcIVI1Riga2COWISSsrwMoXl1biAun7d9Iem3JM EJsIIbsWbJqGq5yN4S1pDLjjeDsbBOGGag/1fMXqkCs/ScLMbRqeJdXOG6T/rZGC s00KA5riqpXZZ/sqaaNNV9dRJ0lagWb/DXUyBPlGEwCHFFKUDNZtGujoWsr2NybD eYv4M7t3bTg1agwJRceaIQ== 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=1706877036; x= 1706963436; bh=3C5bFwJv9LWEX7uXH9OhbPn6aVzr7qyWAUolJmL7emQ=; b=G M6TVMHqdzw6Ad4JtN7ng9dTBDFr/eJ0ih2VN0pFcxFRMqVse9IA4ZgGzwjEuvCz8 ZYuIoiL2km7nIa+V2fNKiCBS3hXbwKYKgfKJABkZ3O58hAPcwy3AmQvvJx5xoy6/ w6Yew322XWxbcGUF9VqlbmHmtI/kQqZFxP/WHKzEIwgIg1+Luc8NEAHeVxPuGU+E ztCrKwLNLAlHT2j+alLLJ/jtu4feGjNtgYQTtunDXjuJxRD/O1ZNDNPRq2r4o1Jh AZ1h8rdIffPFFY6kjHi7iGxfFTjq2U4DpsBRuyMgjprKJ6be/BB/h/kEbM00rSgp jgGUDqGGjalnzB+Cei1Nw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedugedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvedujefhfffhveekhfffkeetvefgteejkeeutdduieehieeg feejtdelveejtedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhg sehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 2 Feb 2024 07:30:34 -0500 (EST) From: Jiaxun Yang Date: Fri, 02 Feb 2024 12:30:26 +0000 Subject: [PATCH v2 1/3] ptrace: Introduce exception_ip arch hook Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240202-exception_ip-v2-1-e6894d5ce705@flygoat.com> References: <20240202-exception_ip-v2-0-e6894d5ce705@flygoat.com> In-Reply-To: <20240202-exception_ip-v2-0-e6894d5ce705@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 X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2422; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=jqYI8HbcM9CNa56K9MGaAYkP5szfqvwINyuXO+HntBI=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhtQ9D9L/qG88d2+OlHtP+o78T0s3chUbPZ8Uvzbu8jpWN g75zrbzHaUsDGJcDLJiiiwhAkp9GxovLrj+IOsPzBxWJpAhDFycAjCRVzMYGR6pPn00Z3LOVYMf +pd5H13RYA/4m6B+6ezjTK8Z5rkHPioy/FMONNv9ubG3cWFPxtH1qnK6706VPv38t/CF1H4RHyU PKx4A X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789790769295529022 X-GMAIL-MSGID: 1789790769295529022 On architectures with delay slot, architecture level instruction pointer (or program counter) in pt_regs may differ from where exception was triggered. Introduce exception_ip hook to invoke architecture code and determine actual instruction pointer to the exception. Link: https://lore.kernel.org/lkml/00d1b813-c55f-4365-8d81-d70258e10b16@app.fastmail.com/ Signed-off-by: Jiaxun Yang --- arch/mips/include/asm/ptrace.h | 2 ++ arch/mips/kernel/ptrace.c | 7 +++++++ include/linux/ptrace.h | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h index daf3cf244ea9..701a233583c2 100644 --- a/arch/mips/include/asm/ptrace.h +++ b/arch/mips/include/asm/ptrace.h @@ -154,6 +154,8 @@ static inline long regs_return_value(struct pt_regs *regs) } #define instruction_pointer(regs) ((regs)->cp0_epc) +extern unsigned long exception_ip(struct pt_regs *regs); +#define exception_ip(regs) exception_ip(regs) #define profile_pc(regs) instruction_pointer(regs) extern asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall); diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index d9df543f7e2c..59288c13b581 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,12 @@ #define CREATE_TRACE_POINTS #include +unsigned long exception_ip(struct pt_regs *regs) +{ + return exception_epc(regs); +} +EXPORT_SYMBOL(exception_ip); + /* * Called by kernel/ptrace.c when detaching.. * diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index eaaef3ffec22..90507d4afcd6 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -393,6 +393,10 @@ static inline void user_single_step_report(struct pt_regs *regs) #define current_user_stack_pointer() user_stack_pointer(current_pt_regs()) #endif +#ifndef exception_ip +#define exception_ip(x) instruction_pointer(x) +#endif + extern int task_current_syscall(struct task_struct *target, struct syscall_info *info); extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact); From patchwork Fri Feb 2 12:30:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 195846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp395459dyc; Fri, 2 Feb 2024 04:37:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0snj41qbnOUhVBEHmD8sRudmKtKPEe7CHWNnLvKXyiwBd3kIDtJQq51s+z/1ZJandg3BN X-Received: by 2002:a17:90a:528a:b0:295:d223:ad11 with SMTP id w10-20020a17090a528a00b00295d223ad11mr7405644pjh.36.1706877434806; Fri, 02 Feb 2024 04:37:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706877434; cv=pass; d=google.com; s=arc-20160816; b=B58tRitFKlm53TaaEE//QV8OTCp8Bo6Dj+bRPNnVbfc8Zwst+o33U8VtSeVdX3eAFr q+uwWTYM6Kp9t3AI458p/7GtRJrXvL8VuvJ3MQgCfL1KoEQAelug4pKxiMzjdrBhHBYj 7tzbijqrBKNuFrwtyIK5pXMNVD4S3d2Tenl69fjHloZlsnULibyPOXwtUVHKT0+uTVfo EmJwHe1Qc5d+4xiMnS1jVOGDtaiaUSvKv8pwLQW93Wwrv7wnEaiAciSbjkSdTILOF1ot 25On8s/0+G7usHiavRSyBwoiNFES83Cdi1fOQtbswnPBzftoeE+/IttZAPRhaEN/gQ9R rSWw== 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=w2r17fGseyKoUkYg1Q+CG1Kwf5xRgoFxjWp3QiPCMOY=; fh=ZN7jK2UX0ftnYkhO0oYtkAaBih5uPEeWijKjGgdRuuQ=; b=lKUpPDbuugxFE/jBS/KzHV/eESKnkPEJVjvj4WQQYm5tOOh3G/mDOIov8xnmxMnn78 mOyhpaB8xXIgc3kfy9crLkTq98W3xN+95rNn/mJ6c/d1FIOZrv9Le3mKw2qKQHldUhO7 t8ClUFyoRK2SsMR2cgzmuP9TB/6eiLtShPOxikqePNTo49aVqwIoN9d88ruf01w/JJFi R44VEzGzB+uy1d8trK1gWn1aqol9gPNELFmKsgYWq897VA1ew0RfsC1/s+nTF0bYh6gy ls2idmylfXyAY4E1tsW02+A5Q5zRiD2+BU1NPy9Jj/AecpeK9HJlwC49MPcYAcu4SeAG zIkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=KPCaY3+u; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=yPVF2ep6; 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-49841-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49841-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com X-Forwarded-Encrypted: i=1; AJvYcCWlikzz7lQS2r/eUOXZFTTzof5NpFWs/kJVwEIpFcFzFlfMqFAAaErkvrgevsHRE6PwsA1csNutjUYP8+7bFIiKYPjPqQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ns21-20020a17090b251500b00295f2e592ddsi1634962pjb.69.2024.02.02.04.37.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 04:37:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49841-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=KPCaY3+u; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=yPVF2ep6; 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-49841-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49841-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 705CF296A54 for ; Fri, 2 Feb 2024 12:31:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 506F91468E7; Fri, 2 Feb 2024 12:30:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="KPCaY3+u"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="yPVF2ep6" Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (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 0876E144624; Fri, 2 Feb 2024 12:30:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.28 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706877042; cv=none; b=QrR/p5Ii9vUhOem+mKTaAVGUWV7TcThpN/L3WQqkSPDC6xyVOKwb1w12e+J3ge+hOLB2asR0DS4IVyD7YjxwUO6HTd5gQcgfLPKla4TGu9Rq4PO2D2TC+mXY0c2dM7Xt24ceUKHuteCiWYQ4Go8uccoHVLBbNPtE1SYqZluKFfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706877042; c=relaxed/simple; bh=eEckd5oJQ3BVb3TI50bExWCbMqs/5XPSjzMz9OXoNmg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uKRvbo9xfnaECIYJ0xjdS3yZMpX/Efrgw5sXqpTTrvvQOMveQylOfSbgW/p5GNIU6PzO/6ka9lh9d2pSVmk9QrpPG33l/R5blPEqMFvce1WxwBZLzs+GCIw6cOxeuRYmvjqmTfhDh3j8PCgVqIwG7M9rbTEHdlWo9uCpTPAvOUY= 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=KPCaY3+u; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=yPVF2ep6; arc=none smtp.client-ip=66.111.4.28 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 00D0A5C00C0; Fri, 2 Feb 2024 07:30:38 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 02 Feb 2024 07:30:38 -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=1706877037; x=1706963437; bh=w2r17fGseyKoUkYg1Q+CG1Kwf5xRgoFxjWp3QiPCMOY=; b= KPCaY3+uIJ73xN9kmYWwqgB93DBfywxqEdTVF6jc120MMGM0qem41ii6ITXekWMz VBrSyQbOQFobNNMOYtJbqvUhxmtWSVWUogeU9JxxLmq05JvxZetbuaVM8hFwtZc7 B+dlZAVTfVuWDfXAy6QGqW6YSij16X4jDd73BiueETOXlSy2csX5Su4y+mBe6Zue FDZIj8Mk8xs4vvI5W7S86b8zCJauqXvPqpGTya19/yJvq6dKYZb1UvcYAbflthp9 2Su/6ZEeuTXPGiTorKVckNAGL24Jk3/kE/y84EUkHooM9TkQQjIHzagTBvRaad5M m2bsiZJgHM3sTlhiUx3AYg== 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=1706877037; x= 1706963437; bh=w2r17fGseyKoUkYg1Q+CG1Kwf5xRgoFxjWp3QiPCMOY=; b=y PVF2ep61M5MoWsoGtC6vryilWqWoSPCuYHTkRIUxkp2m+XgU2WglQGeTgqMRkWen z3n/xeXDSYWxohz/3+6PfCnngrXxukbjVlgRq/M3TbTRhIytfk3C52Q8reQIwY8Y LhlxM1J1GBRMp/5yY34id+Y/jJyXHDFlIlQBTxxvsK3b/y3sZ1oWp3d4a0ZCGQBd mhawXZ3huHsn/FEiDGAcrMNf/6j2mYVmMK5GbdhWDvMmIja2QU72CFCs32FpS54m c4y9+s/rCgzw3TAy1OwJ8QsuYM1UPwOcZ8zjmbL3cQNTtwI77TfFYR1dyB59Btly nIU18gB2KMbJuwqTFfCsg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedugedggedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffekgedugefhtdduudeghfeu veegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 2 Feb 2024 07:30:36 -0500 (EST) From: Jiaxun Yang Date: Fri, 02 Feb 2024 12:30:27 +0000 Subject: [PATCH v2 2/3] MIPS: Clear Cause.BD in instruction_pointer_set Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240202-exception_ip-v2-2-e6894d5ce705@flygoat.com> References: <20240202-exception_ip-v2-0-e6894d5ce705@flygoat.com> In-Reply-To: <20240202-exception_ip-v2-0-e6894d5ce705@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 X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=860; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=eEckd5oJQ3BVb3TI50bExWCbMqs/5XPSjzMz9OXoNmg=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhtQ9D9KbxBb5s2avMMxZk/Fa1OTF/ICgHV78MjaFTJtvf f35OXBNRykLgxgXg6yYIkuIgFLfhsaLC64/yPoDM4eVCWQIAxenAEzE9Dsjwz6v/vdH3Fze1/99 FOW6+OMuxxvHUq8msNTf6zrBPE9PsIThr3h4jgr7uXVaRkt3sXl2P3nPWfRUcFd+muzkppu3Vhz /zQAA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789790712661770591 X-GMAIL-MSGID: 1789790712661770591 Clear Cause.BD after we use instruction_pointer_set to override EPC. This can prevent exception_epc check against instruction code at new return address. It won't be considered as "in delay slot" after epc being overridden anyway. Signed-off-by: Jiaxun Yang --- arch/mips/include/asm/ptrace.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h index 701a233583c2..d14d0e37ad02 100644 --- a/arch/mips/include/asm/ptrace.h +++ b/arch/mips/include/asm/ptrace.h @@ -60,6 +60,7 @@ static inline void instruction_pointer_set(struct pt_regs *regs, unsigned long val) { regs->cp0_epc = val; + regs->cp0_cause &= ~CAUSEF_BD; } /* Query offset/name of register from its name/offset */ From patchwork Fri Feb 2 12:30:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 195852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp405821dyc; Fri, 2 Feb 2024 04:57:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKwJPajxAgRnAvBtHTBgyWABVYtnr5aWVL7s6++PpLbyjHVfa1Rsneo8Q0TIGbrvAfCyIF X-Received: by 2002:a05:6870:7b4d:b0:210:dc9d:5af8 with SMTP id ji13-20020a0568707b4d00b00210dc9d5af8mr1840228oab.37.1706878671341; Fri, 02 Feb 2024 04:57:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706878671; cv=pass; d=google.com; s=arc-20160816; b=nwFYJpNceJ+4XXeifu9tBWUm/y3RSFVjkC06OwiEz37AEQ+5kC/wC4G8R9KWX4Ttiu p8wD/pogufY9y6X5CvkFRBr1ahGm3NjU4OLchvtYS4bd9I4l5mQyVJDfuzPnEYrlbKAx pXUgKawj3mGgc84R19PYiat6MjyLcJzu27ZW/PMJLralQVL7IjFppUK8U4Txli1WUD5n 6uC55Tgb0QNjmHhrJjDTocLDyOtkj4bCX6+UDxbFPdpOXh2SXhPhGry1JPnKoIlLZHdy G/MEw2DqnSaALUW4cK4ap/L7DxPPRX79D6AUwKV8tGDsdaumRMKV8qf5f5/JGffE7UcR zK4A== 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=pr1MVuul0ni1Gime8ZJzvdNUXSMhO2aT9S3BinqEAsk=; b=aqLfDkQ8oWALthuN++xIXE71sNBavLc7LBCfQB3lwH0Cum+voW6R2/aKVzqERrgBAp +w5K+NHA3+QWn1aLMB7ibvqX+OZgpFUtCMTkFzbrQ6/LpMQLxHrpLF8uaKLH8WhGQT8m G1qO/CszPU3arkwspk4IDJ0DHET2c9yEZbUayN2XcQLdF/HDJQz26CuHIUym0RmYRORI Y5VdfP9TQgVhdtraCwEnzHlD8VcVaiIlNOu/9P72qpn8DM81q6wJMSPbUF7A+B2XwO7H A+Ns+hL3NPmmRe6CS2d8di//klPBWQxSvODwvSgnGkW7EtHC48Z4zsYXpePvFBkw8evq A6Jg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=mNL2+pa4; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Cq4Hswe3; 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-49842-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49842-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com X-Forwarded-Encrypted: i=1; AJvYcCXwuPosv4vI0G+/+AT57+F98PgFqscRFym7CtcbcP8qLfK3OYCfP3HItgob9INn28nM1Z00lkLOrGd5p22KUV5Wbw16hA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i6-20020a654846000000b005cdf88fbc11si1591139pgs.48.2024.02.02.04.57.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 04:57:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49842-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=mNL2+pa4; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Cq4Hswe3; 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-49842-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49842-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 70128B29644 for ; Fri, 2 Feb 2024 12:32:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 914F1186A; Fri, 2 Feb 2024 12:30:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="mNL2+pa4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Cq4Hswe3" Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (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 E3076145345; Fri, 2 Feb 2024 12:30:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.28 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706877043; cv=none; b=MLSatz3zxBFOOTT8UkAeOakQakHpX1MeeKEJhS4ZTmmnYX+maD/1zwy2eaJRHm3TdApWOYURcj1HYBY4tVpByiWKVeFLaklKBekesNbIm4MZ8IQ1ohhuc7/9fIeH06UzywqO7Al8Tcfehv1KsZ0q0hObt8o1QNdecb+nFrRJZ0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706877043; c=relaxed/simple; bh=uKuLCoMYm7TN/5FDEmNqhpyC6JKJvRlQkX2qQKN8ZTg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kL6WVmxf6wG6+IjQNhPZr1Gq1Cuc7CKUVcV9Kzl38G83DHlQL6kO6ni37pDmfn8w5jORzLewFiCJF8vvlOonhYy60wO7kHUC0BQiY18SLp1FAsihFC594aFGnSWn7IUzeeU2uU7IZhiwGIfDstx0USyiN5Pm/+hc/ShLw2Yf9sk= 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=mNL2+pa4; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Cq4Hswe3; arc=none smtp.client-ip=66.111.4.28 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 compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E94335C0180; Fri, 2 Feb 2024 07:30:39 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 02 Feb 2024 07:30:39 -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=1706877039; x=1706963439; bh=PkffIQ/TwdfU+2w1YXK1H3DJt1XQppKKQHpkyIAY8Jw=; b= mNL2+pa4mBLckcf1YJNeLqeEfEkNIjSaMXoe0/FrLp02SzGJ1t3KLW7TQO9OrUXc gptTiPkf6xEJzcFsrJmmaP3fCsUyMqC7xRA+KTwybjnLjZRd0HzgwV0Hpw2bMevY DQ+bVp6Wcbe2sKmiK7UhkyRCrq1BPPCVpVdSbfPG+667OCbV20W7ydPsxLBgVJMH PVwxt+msm8xw2LScDcgmsw9zYJAtlnk2NZIT8KBu45qMK6XCj9Zu+luAq6INNCTz MKRctK4ygm6lXXS8eruWRjzvu8IRq6ynqU9WCHZjFBVUj/OjDLAgRPoGsOVl8MQv ymUfDDIqKWIrUCROGYDowQ== 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=1706877039; x= 1706963439; bh=PkffIQ/TwdfU+2w1YXK1H3DJt1XQppKKQHpkyIAY8Jw=; b=C q4Hswe3VCvFGloX8BaUea0BX+Tdp6jIWtdo/NcLMOZ56e2czWHNGBPkiuQbNdzBb HBcnE/O0bfvlN2FqY6HlgqPif8XK2+JNKeADBQsfNLfGp3S7Sp88DXOuv7KROL1M qxYc/MyR+MFHX78qRaPRY1BTHlQgtAwnrxD4cVxCo6jpNlPMqWNmYWKx0HxbUh3V wtwSxtMqXbBHWYzIW6RDV58pXcBTsqQEVKXe3gt3wkwFWhOl69ipCtLw8ErunLPu rjLwCcAM/gYCPYwRX1+qpa/wHGqP1JVs4qH6fUfdd60GVpbNtxrx+5sCKB6OCqeW pPmUmusVQfxGge/Nohhaw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedugedggedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvedujefhfffhveekhfffkeetvefgteejkeeutdduieehieeg feejtdelveejtedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhg sehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 2 Feb 2024 07:30:38 -0500 (EST) From: Jiaxun Yang Date: Fri, 02 Feb 2024 12:30:28 +0000 Subject: [PATCH v2 3/3] mm/memory: Use exception ip to search exception tables Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240202-exception_ip-v2-3-e6894d5ce705@flygoat.com> References: <20240202-exception_ip-v2-0-e6894d5ce705@flygoat.com> In-Reply-To: <20240202-exception_ip-v2-0-e6894d5ce705@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=owGbwMvMwCXmXMhTe71c8zDjabUkhtQ9D9I5oxxuhtd5FaqYPUoS1m9SED32vzE+yratNz1t6 f17PZwdpSwMYlwMsmKKLCECSn0bGi8uuP4g6w/MHFYmkCEMXJwCMJGpQQx/xT/dPrVBSu154PLX /HJvTZJnd/7847ilbPm6i5kqQk9unmX4yVh5i+20gXjQviW/jx/ZZs6cUhVptrg1LabUvf/G1MP JLAA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789792009559148676 X-GMAIL-MSGID: 1789792009559148676 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; }