diff options
author | Kees Cook <keescook@chromium.org> | 2022-05-10 15:46:26 -0700 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2022-05-16 16:02:21 -0700 |
commit | b146cbf2e32f01f56244d670aef2f43d44fcf120 (patch) | |
tree | a6bcf259999645c5e3cea50c6a3d1df5506c7bd5 /net/unix | |
parent | 2dcfe9e2d370f6643486e327c6ae17af8887756c (diff) | |
download | linux-riscv-b146cbf2e32f01f56244d670aef2f43d44fcf120.tar.gz linux-riscv-b146cbf2e32f01f56244d670aef2f43d44fcf120.tar.bz2 linux-riscv-b146cbf2e32f01f56244d670aef2f43d44fcf120.zip |
af_unix: Silence randstruct GCC plugin warning
While preparing for Clang randstruct support (which duplicated many of
the warnings the randstruct GCC plugin warned about), one strange one
remained only for the randstruct GCC plugin. Eliminating this rids
the plugin of the last exception.
It seems the plugin is happy to dereference individual members of
a cross-struct cast, but it is upset about casting to a whole object
pointer. This only manifests in one place in the kernel, so just replace
the variable with individual member accesses. There is no change in
executable instruction output.
Drop the last exception from the randstruct GCC plugin.
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Cong Wang <cong.wang@bytedance.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: netdev@vger.kernel.org
Cc: linux-hardening@vger.kernel.org
Acked-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
Link: https://lore.kernel.org/lkml/20220511022217.58586-1-kuniyu@amazon.co.jp
Acked-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/lkml/20220511151542.4cb3ff17@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'net/unix')
-rw-r--r-- | net/unix/af_unix.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index e71a312faa1e..36367e7e3e0a 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1808,11 +1808,9 @@ static int maybe_init_creds(struct scm_cookie *scm, static bool unix_skb_scm_eq(struct sk_buff *skb, struct scm_cookie *scm) { - const struct unix_skb_parms *u = &UNIXCB(skb); - - return u->pid == scm->pid && - uid_eq(u->uid, scm->creds.uid) && - gid_eq(u->gid, scm->creds.gid) && + return UNIXCB(skb).pid == scm->pid && + uid_eq(UNIXCB(skb).uid, scm->creds.uid) && + gid_eq(UNIXCB(skb).gid, scm->creds.gid) && unix_secdata_eq(scm, skb); } |