From nobody Sun Feb 8 05:34:59 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) (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 4916F329C6A; Thu, 5 Feb 2026 05:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770270991; cv=none; b=S9GljNVsuCZP68SJw8TKn05axKwSAz6iT5ZGfRbXnXbfljXssW/2TrHZmGhD/G1YLZHJsl38C+L/IQcPe+Lnjto/P0PSNZSL8MIWljMhZRT1KUqMwk9FAbfWUR4/dVt3QAlM6PlOzO4IfMqj97vbrHFTzoeGnoCqy39pGk93FZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770270991; c=relaxed/simple; bh=GmBadmPFG0+uU/grZZq1WgpPcJXP8JqTO83GXu+P0Bc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=fdgsJNzQaxQITaUhuXrnKTpNkvM4ksMwlNiZl8X/GTTnZ/up9DoKTvgtPry//DAj31br9y9k7Ak5/uth94/m8aE37fo6bvW/Dk8a5gzhwpvEXgrbaZUODK5/nu7KlF/BT0M/90r8CQDk1F+fZn5AWuYhxAw+FV5/3LdevoYH1EA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=UqaroTsJ; arc=none smtp.client-ip=117.135.210.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="UqaroTsJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version: Content-Type; bh=anyuOPfaC0FFU5Ayq66TRmPlde7GZ+ajJSf6iNlmb60=; b=UqaroTsJ3uWR/EvA8mRwcFNuhqBTRVmqu9qMl4qo2+9EezEMWT4GesrhAokcjz bI3Oo0y+XiIH4p1X+JFsjnhf5VNKap1MDvUuQC/BbzKkMt+zZjVpoIwgokomLr+1 akHq2XIC70Xu+tIP/Dvo5/DGtuvfm9xjqUZ+yDl33vbvU= Received: from pek-lpg-core6.wrs.com (unknown []) by gzga-smtp-mtada-g1-3 (Coremail) with SMTP id _____wCHubzgMIRptHd5KQ--.34727S2; Thu, 05 Feb 2026 13:55:46 +0800 (CST) From: Rahul Sharma To: gregkh@linuxfoundation.org, stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Guo Ren , Palmer Dabbelt , Rahul Sharma Subject: [PATCH 6.1.y] riscv: uprobes: Add missing fence.i after building the XOL buffer Date: Thu, 5 Feb 2026 13:55:40 +0800 Message-Id: <20260205055540.600566-1-black.hawk@163.com> X-Mailer: git-send-email 2.34.1 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="utf-8" Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wCHubzgMIRptHd5KQ--.34727S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7urWfCrW3KrW5CrWxKryxuFg_yoW8ZF1kpF 4Fkw43tr4rX345G347JFs5uw1Fqw1qqr4293y7J3yfZwsFqr17Zwsagr48Xr1YyrZ09rWY v3WqkryDKayDA37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zEb18JUUUUU= X-CM-SenderInfo: 5eoduy4okd4yi6rwjhhfrp/xtbC+gO-WWmEMOPu4gAA3t From: Bj=C3=B6rn T=C3=B6pel [ Upstream commit 7d1d19a11cfbfd8bae1d89cc010b2cc397cd0c48 ] The XOL (execute out-of-line) buffer is used to single-step the replaced instruction(s) for uprobes. The RISC-V port was missing a proper fence.i (i$ flushing) after constructing the XOL buffer, which can result in incorrect execution of stale/broken instructions. This was found running the BPF selftests "test_progs: uprobe_autoattach, attach_probe" on the Spacemit K1/X60, where the uprobes tests randomly blew up. Reviewed-by: Guo Ren Fixes: 74784081aac8 ("riscv: Add uprobes supported") Signed-off-by: Bj=C3=B6rn T=C3=B6pel Link: https://lore.kernel.org/r/20250419111402.1660267-2-bjorn@kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Rahul Sharma --- arch/riscv/kernel/probes/uprobes.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/riscv/kernel/probes/uprobes.c b/arch/riscv/kernel/probes/= uprobes.c index 194f166b2cc4..0d18ee53fd64 100644 --- a/arch/riscv/kernel/probes/uprobes.c +++ b/arch/riscv/kernel/probes/uprobes.c @@ -161,6 +161,7 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned = long vaddr, /* Initialize the slot */ void *kaddr =3D kmap_atomic(page); void *dst =3D kaddr + (vaddr & ~PAGE_MASK); + unsigned long start =3D (unsigned long)dst; =20 memcpy(dst, src, len); =20 @@ -170,13 +171,6 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned= long vaddr, *(uprobe_opcode_t *)dst =3D __BUG_INSN_32; } =20 + flush_icache_range(start, start + len); kunmap_atomic(kaddr); - - /* - * We probably need flush_icache_user_page() but it needs vma. - * This should work on most of architectures by default. If - * architecture needs to do something different it can define - * its own version of the function. - */ - flush_dcache_page(page); } --=20 2.34.1