From nobody Sun Feb 8 07:58:33 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.3]) (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 371302DA776; Fri, 6 Feb 2026 06:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770359248; cv=none; b=WizCp8TK/mGSJpQfqt5Ks9ssNoKNqwF0SkIZyRu7lzASZrmRy/dA+dSl0vraTpHNWbNRedvvYwTzNyfP306c+AWTBkp0vLCCq/wak+D4fiGGOHte48IfyLSQaRZPdGV+kZ5FWhrQfpm7jKoeAKNpqqTX3Pc7qQIHO/lIEMDEIG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770359248; c=relaxed/simple; bh=GmBadmPFG0+uU/grZZq1WgpPcJXP8JqTO83GXu+P0Bc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=AQwRyxXAqqKKlUr0B3MU6X4r6jFNwWzEqdxHEdWZJrl7iAoUoy1SFkMCB4CXeBSSfT/Rjl5VmkvT5nlBIDyvxIJMb5XWNWIVL0IxwHKmPwG6m6H45wP8sVZsWeFyZlcM8CJeu8YPXOOhmumu8mjoJvyrdIuyHaCWfh0YioGVAcM= 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=n1hLwZNJ; arc=none smtp.client-ip=117.135.210.3 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="n1hLwZNJ" 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=n1hLwZNJdWmGLC4MtlMRIWNhxFAvBP/UAMUflzm5CUnchVHsRPAtzNH5VLOKoe eQfJ9WdjabwtIgCkCTVyJKE3WqlkxgUPrvJqz4rLyTZec1H12tMn3/ZH/y035yVd pjQtb7W0DMFhXKjrdzZ9fd3qtGvBTVJyMmmsa6wH1E+pU= Received: from pek-lpg-core6.wrs.com (unknown []) by gzga-smtp-mtada-g1-2 (Coremail) with SMTP id _____wBHz72siYVpqhtDJg--.520S2; Fri, 06 Feb 2026 14:26:53 +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 5.15.y] riscv: uprobes: Add missing fence.i after building the XOL buffer Date: Fri, 6 Feb 2026 14:26:50 +0800 Message-Id: <20260206062650.1065402-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: _____wBHz72siYVpqhtDJg--.520S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7urWfCrW3KrW5CrWxKryxuFg_yoW8ZF1kpF 4Fkw43tr4rX345G347JFs5uw1Fqw1qqr4293y7J3yfZwsFqr17Zwsagr48Xr1YyrZ09rWY v3WqkryDKayDA37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0z_R6wAUUUUU= X-CM-SenderInfo: 5eoduy4okd4yi6rwjhhfrp/xtbC+Q1J4mmFia3W5QAA3k 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