Re: [PATCH] x86/dumpstack: fix address space casting in show_opcodes()

From: Luc Van Oostenryck
Date: Fri Aug 31 2018 - 10:38:08 EST


On Fri, Aug 31, 2018 at 03:26:24PM +0200, Jann Horn wrote:
>
> By the way, here are all 60 probe_kernel_read() callers:

...

> 41 of these (or something like that, I counted by hand) have some sort
> of cast in the call expression.
> probe_kernel_read() is kinda special in that expected types for the
> second argument are both kernel pointers and unsigned longs. It might
> make sense to have a wrapper macro around probe_kernel_read() that
> accepts anything as long as it's as wide as a pointer...

Well, if __user pointers should not be accepted, then it's much
better, typewisely, to leave it as const void * (and cast the
ulong args to some plain generic pointer, like void* or u8*).

-- Luc Van Oostenryck