Skip to content

Commit

Permalink
randstruct: Whitelist struct security_hook_heads cast
Browse files Browse the repository at this point in the history
The LSM initialization routines walk security_hook_heads as an array
of struct list_head instead of via names to avoid a ton of needless
source. Whitelist this to avoid the false positive warning from the
plugin:

security/security.c: In function ‘security_init’:
security/security.c:59:20: note: found mismatched op0 struct pointer types: ‘struct list_head’ and ‘struct security_hook_heads’

  struct list_head *list = (struct list_head *) &security_hook_heads;
                    ^

Cc: Tetsuo Handa <[email protected]>
Cc: James Morris <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
  • Loading branch information
kees committed Jun 22, 2017
1 parent 313dd1b commit fd466e0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/gcc-plugins/randomize_layout_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ struct whitelist_entry {
};

static const struct whitelist_entry whitelist[] = {
/* walk struct security_hook_heads as an array of struct list_head */
{ "security/security.c", "list_head", "security_hook_heads" },
{ }
};

Expand Down

0 comments on commit fd466e0

Please sign in to comment.