From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 856423A5E67 for ; Fri, 31 Jul 2026 15:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785513440; cv=none; b=pd+2E5ApRxmANvW9VkSPxRxlorFo274GtFg9WY68ReQhqxKDWqjo9DDwyw4fYp2UP3vudOa5Tj9GOopUY30Z8WzHUAK3yX0Qs7YNkU0W8oSKRnG77Ff6R/fS46yzGTcmDUCL+oZbKS22HTXHQHqKjTSynRc2WXoFqObEr7wU+Y4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785513440; c=relaxed/simple; bh=3fE17VY55jEg8Yh3SdwZWySOppkdrVhRKTzR+2tl0VA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dAZMywRA27mQTWxQ7ghYWbbog1LsQB3mYMArkMME5Vc54H9S3dI17R1gK1A7OzECk5wiKiFIQR/3kAGQ6XfJgvedWu9qXegNIJzOWfhNU4LZzSh1E5DFcJPAgSRfuFh2GfwqzLAWPjxNYYoVMTRMdB7EqK+28KH8sjY4TnMUZ1w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=MybJcXmn; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="MybJcXmn" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ACFC8204C; Fri, 31 Jul 2026 08:57:13 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 59F3D3F66F; Fri, 31 Jul 2026 08:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1785513437; bh=3fE17VY55jEg8Yh3SdwZWySOppkdrVhRKTzR+2tl0VA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MybJcXmny7qIExuu143hMNLviFJLnxpF70W9oe2p4DTW3MnID/2HuO5QNgXiysHEi FGGmh7m8ehcMMWp6YJG0lPt1Az0XridfkJ+FvSlcBJTCRTdFOiq3ZmssZm4stks/xa zTTmlB0nZseiYr7fywVupjtsg5kCan2d0oCo/8YU= Date: Fri, 31 Jul 2026 16:57:13 +0100 From: Mark Rutland To: Hongyan Xia Cc: Will Deacon , Masami Hiramatsu , Catalin Marinas , Jiazi Li , Pu Hu , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [RFC PATCH 6/9] arm64/kprobes: Make kprobe_fault_handler() noinstr Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jul 27, 2026 at 12:25:43PM +0000, Hongyan Xia wrote: > From: Hongyan Xia > > kprobe_fault_handler() is reached from do_page_fault() when a fault > happens while a kprobe single-step is armed. Everything it calls (the > save/restore helpers, kprobes_restore_local_irqflag(), > reset_current_kprobe(), register access) is noinstr after the previous > patch, and being called from an instrumentable caller into a noinstr > callee is fine. I think it's fine to mark this as noinstr. I don't think we need kprobe_fault_handler() in the first place given we don't permit kprobes to be placed on instructions with an extable entry. Any instruction which can be probled cannot legitimately cause a fault. That and kprobes_restore_local_irqflag() can't do the right thing w.r.t DAIF, since it only fiddles with the value in the pt_regs, and doesn't touch the live inherited DAIF value. If we need to fiddle with the live DAIF value, we must do that much earlier in the entry-common code. Mark. > Signed-off-by: Hongyan Xia > --- > arch/arm64/kernel/probes/kprobes.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c > index e9fa66fa4217..4172998d48d9 100644 > --- a/arch/arm64/kernel/probes/kprobes.c > +++ b/arch/arm64/kernel/probes/kprobes.c > @@ -310,7 +310,7 @@ post_kprobe_handler(struct kprobe *cur, struct kprobe_ctlblk *kcb, struct pt_reg > reset_current_kprobe(); > } > > -int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr) > +int noinstr kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr) > { > struct kprobe *cur = kprobe_running(); > struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); > -- > 2.47.3 >