[PATCH] riscv: kprobe: Fixup misaligned load text

Guo Ren guoren at kernel.org
Sun Feb 5 19:10:12 PST 2023


On Thu, Feb 2, 2023 at 10:36 PM Björn Töpel <bjorn at kernel.org> wrote:
>
> Jessica Clarke <jrtc27 at jrtc27.com> writes:
>
> >> +    p->opcode = *insn++;
> >> +    if (GET_INSN_LENGTH(p->opcode) == 4)
> >> +            p->opcode |= *insn << 16;
> >
> > *insn gets promoted to int not unsigned so this is UB if bit 15 is set.
>
> Ugh. Good catch! I guess we can't get rid of *that* explicit cast to
> kprobe_opcode_t here...
Hi Bjorn & Jessica,
Thx for reviewing.

The new version came out:
https://lore.kernel.org/linux-riscv/20230204063531.740220-1-guoren@kernel.org/





--
Best Regards
 Guo Ren



More information about the linux-riscv mailing list