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 CAAB7429CD6 for ; Fri, 31 Jul 2026 16:12:27 +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=1785514351; cv=none; b=dXYbjqZm46MHNYfQZRGK3/hQLi3K+JS6aumTxh9bWQV9yt/0yr21+829pi8BG6GIEwdkPYe55W/ViLrq7vYJsQqAdPyKFdevAeokvmK7wfkQ95o/kuokrNfUB2vkqY1woncDu6ejOIFSNmXwaYbA79ZO75IupJ25EqakdiIWk2g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785514351; c=relaxed/simple; bh=OIrbsNtLBKqeLLiyTmESOoHaJ+8BZ8ouhX3sjsjrM2w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JvaXh6d1SUl+bgE1q5IeQW7HXVH055F+f2xgUh2+LPZ3zhuUmUCVleKZzhevF60HUVdNEH8BuJWhL3Va/68cWVcGmRsvdHMd2xNusf0gY8FWuD2tgMbZkMR++Be44nf8wk3ZxyFYsMMcjzBEKvrpIUNj3LK6GE/c7e/5ZbkbFjM= 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=dKRnAsad; 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="dKRnAsad" 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 15FAF204C; Fri, 31 Jul 2026 09:12:22 -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 BAF1C3F86F; Fri, 31 Jul 2026 09:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1785514346; bh=OIrbsNtLBKqeLLiyTmESOoHaJ+8BZ8ouhX3sjsjrM2w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dKRnAsadszwh0OBdqjd4fc4kmNwbh8RndSsUlRaaR32LyiuOp2fTCLLcgkfvwdBUJ D5hWgZKuZz357hFEDQu64Wh29dOX+/+7SHrYKCvHI9U3dQoXUS0WJIkA3u7OcQoplt Fw5rXoJblKMhfAu75Yr96Qu/WYf06FMIC+BnnhDA= Date: Fri, 31 Jul 2026 17:12:22 +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 8/9] arm64/kprobes: Drop the XOL single-step fault PC check Message-ID: References: <747c80a43d3345cae59ec1456dfff45d237981dc.1785153469.git.hongyan.xia@transsion.com> 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: <747c80a43d3345cae59ec1456dfff45d237981dc.1785153469.git.hongyan.xia@transsion.com> On Mon, Jul 27, 2026 at 12:25:46PM +0000, Hongyan Xia wrote: > From: Hongyan Xia > > With the armed single-step window closed (the whole path noinstr, and > every piece of instrumentable code confined to instrumentation windows > that run in KPROBE_HIT_ACTIVE/HIT_SSDONE state), no code other than the > XOL instruction itself can execute while the state is KPROBE_HIT_SS or > KPROBE_REENTER. A page fault taken in those states therefore necessarily > originates from the XOL instruction, and the faulting-PC comparison is > redundant; revert to handling all such faults as single-step faults (as > before commit 879a6754d3d1). > > The simulated-kprobe early bail is kept: simulated probes have no XOL > slot and execute (inside an instrumentation window) in debug trap > context, so a fault there can still come from the simulation handlers > and must not be treated as a single-step fault. As commented on an earlier patch, to fix this properly I think we have to make the simulation noinstr-safe. Mark. > > Signed-off-by: Hongyan Xia > --- > arch/arm64/kernel/probes/kprobes.c | 12 ------------ > 1 file changed, 12 deletions(-) > > diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c > index 1658b6acd803..73bbbcdbbfe5 100644 > --- a/arch/arm64/kernel/probes/kprobes.c > +++ b/arch/arm64/kernel/probes/kprobes.c > @@ -309,18 +309,6 @@ int noinstr kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr) > switch (kcb->kprobe_status) { > case KPROBE_HIT_SS: > case KPROBE_REENTER: > - /* > - * A page fault taken while in KPROBE_HIT_SS or > - * KPROBE_REENTER state is only attributable to kprobe > - * single-stepping if the faulting PC points to the > - * current kprobe's XOL instruction. If the fault occurred > - * elsewhere (e.g. in perf or tracing code invoked from the > - * debug exception path), leave it for the normal page fault > - * handler to process. > - */ > - if (instruction_pointer(regs) != (unsigned long)cur->ainsn.xol_insn) > - break; > - > /* > * We are here because the instruction being single > * stepped caused a page fault. We reset the current > -- > 2.47.3 >