From mboxrd@z Thu Jan 1 00:00:00 1970 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 634853D7D65 for ; Wed, 1 Jul 2026 08:11: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=1782893497; cv=none; b=Zw5ahkatDhxBvFE72/gS7Qvm6sjJ2deJIx1eEiYuvjv8t2/vVrP4SKx0ctM0NQIDK8j3N7MW8SeyWiMuA0zt3ty9mqKuKRw2b16AdxFfnQDTKZ1dnXWrIcPQSQHrRHqB+QAXHFKRuudFkaTvBZW0jnPuKKi98oCPNKWeQu0rlmc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782893497; c=relaxed/simple; bh=Wr2Gj7toGNtqut9PdNH1drE7ThkWN/2tenld2g2d834=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dWT3t1tri+S7R0QAWsNVsPoMVYQFCX0G0AV3/Xe8zkYrZq1PDxos2Uxb04TIxWGzIjqbVcsWE08qE9FIItxRV449ocil21m6G5L+3O4DlRSLVcVvgBfL8cH8cdqgR9EJOOKdGKeEri1cYZPWx2TvMKSNfCkxu/5XXgtSbRKXmZM= 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=WihMo6NO; 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="WihMo6NO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=Wb wcrkvltTRky39IqZSfJP2Rrr6GyP3++S2L3ERsYI8=; b=WihMo6NO4h8yiD0DtI r5dRnTLAlL+8NzEyTunzM4lxx3Zz+zvFJiHZpDTmUF7Yxe66vYN/eKfiG0cQwfem tjIvvwfuSppZR4w36LcDzAhjV/jBML733vze38m604HFJPICcMWrIvIzvchTwse9 MHPeJRAsaq37BX3EdMo/UFqbQ= Received: from Ubuntu.. (unknown []) by gzsmtp4 (Coremail) with SMTP id PygvCgBHa+Z5y0Rqn4gyFA--.16458S2; Wed, 01 Jul 2026 16:10:34 +0800 (CST) From: Xiaofeng Yuan To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Charlie Jenkins , Nam Cao , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, xiaofengmian@163.com Subject: [PATCH v6 0/2] riscv: add c.jal instruction simulation for kprobes Date: Wed, 1 Jul 2026 08:10:31 +0000 Message-ID: <20260701081033.49871-1-xiaofengmian@163.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:PygvCgBHa+Z5y0Rqn4gyFA--.16458S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kw1UKw1UCF17WF1kWrykKrg_yoW8Gw1fpF s8C3y5tFWjvFs7GFy3JF4xZr4Sga1rGr43WF12yw4Fq348ur92vF1qgrWakFsIgr4Sg3sF 9ry2qF95uFy3ArJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pEv38UUUUUU= X-CM-SenderInfo: p0ld0w5hqjzxldq6il2tof0z/xtbC5Rq8v2pEy3rHgAAA3k The c.jal instruction is part of the RISC-V compressed instruction set and is defined only on RV32. Currently kprobes rejects it, causing probes placed on c.jal to fail. This series adds simulation support for c.jal and includes a test case by Nam Cao. Changes since v5: - Removed the #if __riscv_xlen == 32 guards around simulate_c_jal() as both Charlie Jenkins and Nam Cao agreed they are unnecessary. On RV64, riscv_insn_is_c_jal() always returns 0 so the simulation code is never invoked, and the small overhead in kernel size is acceptable. - Included Nam Cao's test case for c.jal instruction simulation. Changes since v4: - Reuse simulate_c_j() for the jump logic (Nam Cao) - Use direct register assignment instead of rv_insn_reg_set_val() - Move RISCV_INSN_SET_SIMULATE(c_jal) to group with other compressed jump instructions Nam Cao (1): riscv: kprobes: add test case for c.jal instruction simulation Xiaofeng Yuan (1): riscv: probes: simulate c.jal instruction Nam Cao (1): riscv: kprobes: add test case for c.jal instruction simulation Xiaofeng Yuan (1): riscv: probes: simulate c.jal instruction arch/riscv/kernel/probes/decode-insn.c | 2 +- arch/riscv/kernel/probes/simulate-insn.c | 7 ++++++ arch/riscv/kernel/probes/simulate-insn.h | 1 + .../kernel/tests/kprobes/test-kprobes-asm.S | 24 +++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) -- 2.43.0