Skip to content

Commit 1854c19

Browse files
committed
randstruct: Whitelist NIU struct page overloading
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 <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent 802762c commit 1854c19

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

scripts/gcc-plugins/randomize_layout_plugin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ struct whitelist_entry {
4646
};
4747

4848
static const struct whitelist_entry whitelist[] = {
49+
/* NIU overloads mapping with page struct */
50+
{ "drivers/net/ethernet/sun/niu.c", "page", "address_space" },
4951
/* unix_skb_parms via UNIXCB() buffer */
5052
{ "net/unix/af_unix.c", "unix_skb_parms", "char" },
5153
/* big_key payload.data struct splashing */

0 commit comments

Comments
 (0)