lkml.org 
[lkml]   [2017]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 08/20] randstruct: Whitelist NIU struct page overloading
    Date
    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@davemloft.net>
    Signed-off-by: Kees Cook <keescook@chromium.org>
    ---
    scripts/gcc-plugins/randomize_layout_plugin.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/scripts/gcc-plugins/randomize_layout_plugin.c b/scripts/gcc-plugins/randomize_layout_plugin.c
    index 5f4e59a78eeb..f777ead58ba8 100644
    --- a/scripts/gcc-plugins/randomize_layout_plugin.c
    +++ b/scripts/gcc-plugins/randomize_layout_plugin.c
    @@ -43,6 +43,8 @@ struct whitelist_entry {
    };

    static const struct whitelist_entry whitelist[] = {
    + /* NIU overloads mapping with page struct */
    + { "drivers/net/ethernet/sun/niu.c", "page", "address_space" },
    /* unix_skb_parms via UNIXCB() buffer */
    { "net/unix/af_unix.c", "unix_skb_parms", "char" },
    /* big_key payload.data struct splashing */
    --
    2.7.4
    \
     
     \ /
      Last update: 2017-05-27 03:50    [W:3.302 / U:1.496 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site