diff options
author | Kees Cook <keescook@chromium.org> | 2017-04-05 00:35:22 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-06-22 19:21:41 -0400 |
commit | b07b65846ba33a4deba03eb6e39043c8bc70903b (patch) | |
tree | 9d9179213690fc7e67aee1e2c602c30a574719f7 /scripts/gcc-plugins/randomize_layout_plugin.c | |
parent | fd466e068e5adef5922b76f24374c96ba01faaa2 (diff) |
randstruct: Whitelist UNIXCB cast
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: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'scripts/gcc-plugins/randomize_layout_plugin.c')
-rw-r--r-- | scripts/gcc-plugins/randomize_layout_plugin.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/gcc-plugins/randomize_layout_plugin.c b/scripts/gcc-plugins/randomize_layout_plugin.c index dc0df3765a8f..2e710bf29699 100644 --- a/scripts/gcc-plugins/randomize_layout_plugin.c +++ b/scripts/gcc-plugins/randomize_layout_plugin.c | |||
@@ -46,6 +46,8 @@ struct whitelist_entry { | |||
46 | }; | 46 | }; |
47 | 47 | ||
48 | static const struct whitelist_entry whitelist[] = { | 48 | static const struct whitelist_entry whitelist[] = { |
49 | /* unix_skb_parms via UNIXCB() buffer */ | ||
50 | { "net/unix/af_unix.c", "unix_skb_parms", "char" }, | ||
49 | /* walk struct security_hook_heads as an array of struct list_head */ | 51 | /* walk struct security_hook_heads as an array of struct list_head */ |
50 | { "security/security.c", "list_head", "security_hook_heads" }, | 52 | { "security/security.c", "list_head", "security_hook_heads" }, |
51 | { } | 53 | { } |