FAILED: patch "[PATCH] riscv: kprobe: Fixup misaligned load text" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Possible dependencies:
eb7423273cc9 ("riscv: kprobe: Fixup misaligned load text") 9c89bb8e3272 ("kprobes: treewide: Cleanup the error messages for kprobes")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From eb7423273cc9922ee2d05bf660c034d7d515bb91 Mon Sep 17 00:00:00 2001
From: Guo Ren <[email protected]>
Date: Sat, 4 Feb 2023 01:35:31 -0500
Subject: [PATCH] riscv: kprobe: Fixup misaligned load text
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The current kprobe would cause a misaligned load for the probe point. This patch fixup it with two half-word loads instead.
arch/riscv/kernel/probes/kprobes.c +5 -3
@@ -65,16 +65,18 @@ static bool __kprobes arch_check_kprobe(struct kprobe *p)int __kprobes arch_prepare_kprobe (struct kprobe *p) { -unsigned long probe_addr = (unsigned long )p->addr; +u16 *insn = (u16 *)p->addr; -if (probe_addr &0x1 ) +if ((unsigned long )insn &0x1 )return -EILSEQ ;if (!arch_check_kprobe (p))return -EILSEQ ;/* copy instruction */ - p->opcode = *p->addr; + p->opcode = (kprobe_opcode_t)(*insn++); +if (GET_INSN_LENGTH (p->opcode) ==4 ) + p->opcode |= (kprobe_opcode_t)(*insn) <<16 ;/* decode instruction */ switch (riscv_probe_decode_insn (p->addr, &p->ainsn.api)) {