Re: [PATCH 1/2] x86/insn: Fix some potential undefined behavior.

2020-10-15 Thread Peter Zijlstra
On Wed, Oct 14, 2020 at 11:21:47PM -0700, Ian Rogers wrote: > From: Numfor Mbiziwo-Tiapo > > 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 ju

Re: [PATCH 1/2] x86/insn: Fix some potential undefined behavior.

2020-10-15 Thread Masami Hiramatsu
On Wed, 14 Oct 2020 23:21:47 -0700 Ian Rogers wrote: > From: Numfor Mbiziwo-Tiapo > > 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. Maybe we should check the kaddr and end_kaddr existence in insn_init(). At leas

Re: [PATCH 1/2] x86/insn: Fix some potential undefined behavior.

2020-10-15 Thread Ingo Molnar
* Ian Rogers wrote: > From: Numfor Mbiziwo-Tiapo > > 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. > > Don't perform unaligned loads in __get_next and __peek_nbyte_next as > these are forms of undefined behavi

[PATCH 1/2] x86/insn: Fix some potential undefined behavior.

2020-10-14 Thread Ian Rogers
From: Numfor Mbiziwo-Tiapo 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. Don't perform unaligned loads in __get_next and __peek_nbyte_next as these are forms of undefined behavior. These problems were identified us