Message ID | 20230204063531.740220-1-guoren@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | eb7423273cc9922ee2d05bf660c034d7d515bb91 |
Delegated to: | Palmer Dabbelt |
Headers | show |
Series | [V2] riscv: kprobe: Fixup misaligned load text | expand |
Context | Check | Description |
---|---|---|
conchuod/cover_letter | success | Single patches do not need cover letters |
conchuod/tree_selection | success | Guessed tree name to be fixes |
conchuod/fixes_present | success | Fixes tag present in non-next series |
conchuod/maintainers_pattern | success | MAINTAINERS pattern errors before the patch: 13 and now 13 |
conchuod/verify_signedoff | success | Signed-off-by tag matches author and committer |
conchuod/kdoc | success | Errors and warnings before: 0 this patch: 0 |
conchuod/build_rv64_clang_allmodconfig | success | Errors and warnings before: 3 this patch: 3 |
conchuod/module_param | success | Was 0 now: 0 |
conchuod/build_rv64_gcc_allmodconfig | success | Errors and warnings before: 19 this patch: 19 |
conchuod/alphanumeric_selects | success | Out of order selects before the patch: 57 and now 57 |
conchuod/build_rv32_defconfig | success | Build OK |
conchuod/dtb_warn_rv64 | success | Errors and warnings before: 2 this patch: 2 |
conchuod/header_inline | success | No static functions without inline keyword in header files |
conchuod/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 21 lines checked |
conchuod/source_inline | success | Was 0 now: 0 |
conchuod/build_rv64_nommu_k210_defconfig | success | Build OK |
conchuod/verify_fixes | success | Fixes tag looks correct |
conchuod/build_rv64_nommu_virt_defconfig | success | Build OK |
guoren@kernel.org writes: > From: Guo Ren <guoren@linux.alibaba.com> > > The current kprobe would cause a misaligned load for the probe point. > This patch fixup it with two half-word loads instead. > > Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported") > Signed-off-by: Guo Ren <guoren@linux.alibaba.com> > Signed-off-by: Guo Ren <guoren@kernel.org> > Link: https://lore.kernel.org/linux-riscv/878rhig9zj.fsf@all.your.base.are.belong.to.us/ > Reported-by: Bjorn Topel <bjorn.topel@gmail.com> > Cc: Jessica Clarke <jrtc27@jrtc27.com> > --- > Changelog > V2: > - Optimize coding convention (Thx Bjorn & Jessica) Thank you for fixing this! Reviewed-by: Björn Töpel <bjorn@kernel.org>
On Sat, 04 Feb 2023 01:35:31 -0500, guoren@kernel.org wrote: > The current kprobe would cause a misaligned load for the probe point. > This patch fixup it with two half-word loads instead. > > Applied, thanks! [1/1] riscv: kprobe: Fixup misaligned load text https://git.kernel.org/palmer/c/eb7423273cc9 Best regards,
Hello: This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <palmer@rivosinc.com>: On Sat, 4 Feb 2023 01:35:31 -0500 you wrote: > From: Guo Ren <guoren@linux.alibaba.com> > > The current kprobe would cause a misaligned load for the probe point. > This patch fixup it with two half-word loads instead. > > Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported") > Signed-off-by: Guo Ren <guoren@linux.alibaba.com> > Signed-off-by: Guo Ren <guoren@kernel.org> > Link: https://lore.kernel.org/linux-riscv/878rhig9zj.fsf@all.your.base.are.belong.to.us/ > Reported-by: Bjorn Topel <bjorn.topel@gmail.com> > Cc: Jessica Clarke <jrtc27@jrtc27.com> > > [...] Here is the summary with links: - [V2] riscv: kprobe: Fixup misaligned load text https://git.kernel.org/riscv/c/eb7423273cc9 You are awesome, thank you!
diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c index c41bd8509032..d3b18e868f30 100644 --- a/arch/riscv/kernel/probes/kprobes.c +++ b/arch/riscv/kernel/probes/kprobes.c @@ -71,16 +71,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)) {