Re: [PATCH] x86/dumpstack: fix address space casting in show_opcodes()
From: Luc Van Oostenryck
Date: Fri Aug 31 2018 - 04:27:19 EST
On Thu, Aug 30, 2018 at 09:47:36PM +0200, Jann Horn wrote:
> I sloppily passed a kernel-typed pointer to __range_not_ok(), and sparse
> doesn't like that.
> Make `prologue` a __user pointer (to protect against accidental
> dereferences) and force-cast it to a kernel pointer when calling
> probe_kernel_read(), which will then immediately force-cast it back to a
> user pointer.
It's a bit sad to have to do this.
__range_not_ok() explicitly requires a __user pointer (I don't know
if there is a good reason for it) but the real job is done by
__chk_range_not_ok(). Can't you use this later instead?
-- Luc Van Oostenryck