[PATCH] riscv: kprobe: Fixup misaligned load text

Björn Töpel bjorn at kernel.org
Thu Feb 2 06:36:29 PST 2023


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...



More information about the linux-riscv mailing list