randstruct: Whitelist struct security_hook_heads cast
authorKees Cook <keescook@chromium.org>
Tue, 4 Apr 2017 23:50:45 +0000 (16:50 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 22 Jun 2017 23:21:40 +0000 (16:21 -0700)
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 <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: James Morris <james.l.morris@oracle.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
scripts/gcc-plugins/randomize_layout_plugin.c

index e1d1ba28739f1d368e7483a3bda141b303d73487..dc0df3765a8fef37f6420570eaf467a045ac210d 100644 (file)
@@ -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" },
        { }
 };