Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

randstruct: Whitelist big_key path struct overloading

The big_key payload structure intentionally stores a struct path in
two void pointers to avoid header soup. Whitelist this case:

security/keys/big_key.c: In function ‘big_key_read’:
security/keys/big_key.c:293:16: note: found mismatched rhs struct pointer types: ‘struct path’ and ‘void *’

struct path *path = (struct path *)&key->payload.data[big_key_path];
^~~~

Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Kees Cook <keescook@chromium.org>

+2
+2
scripts/gcc-plugins/randomize_layout_plugin.c
··· 48 48 static const struct whitelist_entry whitelist[] = { 49 49 /* unix_skb_parms via UNIXCB() buffer */ 50 50 { "net/unix/af_unix.c", "unix_skb_parms", "char" }, 51 + /* big_key payload.data struct splashing */ 52 + { "security/keys/big_key.c", "path", "void *" }, 51 53 /* walk struct security_hook_heads as an array of struct list_head */ 52 54 { "security/security.c", "list_head", "security_hook_heads" }, 53 55 { }