From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031295AbdE0BNT (ORCPT ); Fri, 26 May 2017 21:13:19 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:37587 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S944887AbdEZUUP (ORCPT ); Fri, 26 May 2017 16:20:15 -0400 MIME-Version: 1.0 In-Reply-To: <1495829844-69341-7-git-send-email-keescook@chromium.org> References: <1495829844-69341-1-git-send-email-keescook@chromium.org> <1495829844-69341-7-git-send-email-keescook@chromium.org> From: Kees Cook Date: Fri, 26 May 2017 13:20:13 -0700 X-Google-Sender-Auth: mYF9cSJ1uWZcksrWskPYRFjt36o Message-ID: Subject: Re: [PATCH v2 06/20] randstruct: Whitelist UNIXCB cast To: "kernel-hardening@lists.openwall.com" Cc: Kees Cook , Hannes Frederic Sowa , "Signed-off-by : David S . Miller" , Laura Abbott , "x86@kernel.org" , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v4R1jGNj021112 On Fri, May 26, 2017 at 1:17 PM, Kees Cook wrote: > 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 > Cc: Signed-off-by: David S. Miller Argh, paste-o. I was adding git history folks here to Cc, pardon the glitch. This should be Cc: and absolutely not a S-o-B from Dave. -Kees > Signed-off-by: Kees Cook > --- > scripts/gcc-plugins/randomize_layout_plugin.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/scripts/gcc-plugins/randomize_layout_plugin.c b/scripts/gcc-plugins/randomize_layout_plugin.c > index e126ac7874af..bf110915a5aa 100644 > --- a/scripts/gcc-plugins/randomize_layout_plugin.c > +++ b/scripts/gcc-plugins/randomize_layout_plugin.c > @@ -43,6 +43,8 @@ struct whitelist_entry { > }; > > static const struct whitelist_entry whitelist[] = { > + /* unix_skb_parms via UNIXCB() buffer */ > + { "net/unix/af_unix.c", "unix_skb_parms", "char" }, > /* walk struct security_hook_heads as an array of struct list_head */ > { "security/security.c", "list_head", "security_hook_heads" }, > { } > -- > 2.7.4 > -- Kees Cook Pixel Security