Re: [PATCH v2 08/20] randstruct: Whitelist NIU struct page overloading

From: Christoph Hellwig
Date: Sun May 28 2017 - 04:16:01 EST


On Fri, May 26, 2017 at 01:17:12PM -0700, Kees Cook wrote:
> The NIU ethernet driver intentionally stores a page struct pointer on
> top of the "mapping" field. Whitelist this case:
>
> drivers/net/ethernet/sun/niu.c: In function âniu_rx_pkt_ignoreâ:
> drivers/net/ethernet/sun/niu.c:3402:10: note: found mismatched ssa struct pointer types: âstruct pageâ and âstruct address_spaceâ
>
> *link = (struct page *) page->mapping;
> ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Cc: David S. Miller <davem@xxxxxxxxxxxxx>
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>

The driver really needs to stop doing this anyway. It would be good
to send this out to linux-mm and netdev to come up with a better scheme.