• Kees Cook's avatar
    randstruct: Whitelist UNIXCB cast · b07b6584
    Kees Cook authored
    This is another false positive in bad cast detection:
    
    net/unix/af_unix.c: In function ‘unix_skb_scm_eq’:
    net/unix/af_unix.c:1621:31: note: found mismatched rhs struct pointer types: ‘struct unix_skb_parms’ and ‘char’
    
      const struct unix_skb_parms *u = &UNIXCB(skb);
                                   ^
    
    UNIXCB is:
    
    	#define UNIXCB(skb)     (*(struct unix_skb_parms *)&((skb)->cb))
    
    And ->cb is:
    
    	char                    cb[48] __aligned(8);
    
    This is a rather crazy cast, but appears to be safe in the face of
    randomization, so whitelist it in the plugin.
    
    Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
    Cc: David S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    b07b6584
randomize_layout_plugin.c 26.6 KB