Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170528075654.GC22193@infradead.org>
Date: Sun, 28 May 2017 00:56:54 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Kees Cook <keescook@...omium.org>
Cc: kernel-hardening@...ts.openwall.com,
	Hannes Frederic Sowa <hannes@...essinduktion.org>,
	"Signed-off-by : David S . Miller" <davem@...emloft.net>,
	Laura Abbott <labbott@...hat.com>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 06/20] randstruct: Whitelist UNIXCB cast

On Fri, May 26, 2017 at 01:17:10PM -0700, 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.

We have a lot of network protocol that use the ->cb area, which makes me
wonder why this one would be so special.

It seems like everyone is just using a plain cast to a pointer without
doing the address taking trick that doesn't make sense for arrays
anyway.

Maybe we just need to fix up the af_unix code to work the same as all
other protocols?

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.