Re: [PATCH 1/2] x86/insn: Fix some potential undefined behavior.
From: Peter Zijlstra
Date: Thu Oct 15 2020 - 06:05:38 EST
On Wed, Oct 14, 2020 at 11:21:47PM -0700, Ian Rogers wrote:
> From: Numfor Mbiziwo-Tiapo <nums@xxxxxxxxxx>
>
> If insn_init is given a NULL kaddr and 0 buflen then validate_next will
> perform arithmetic on NULL, add a guard to avoid this.
How is this a problem? NULL is (void *)0, you can do arithmetic on that
just fine.
Is UBSAN taking drugs again?
> Don't perform unaligned loads in __get_next and __peek_nbyte_next as
> these are forms of undefined behavior.
Fair enough; that could actually be a problem when we start to
cross-build this stuff. A RISC hosted version of the x86 decoder could
indeed trip this up.
But also, these are two changes in one patch.