[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202205111624.60295F3A2@keescook>
Date: Wed, 11 May 2022 16:25:11 -0700
From: Kees Cook <keescook@...omium.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
Christoph Hellwig <hch@...radead.org>,
"David S. Miller" <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>, Du Cheng <ducheng2@...il.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Vlastimil Babka <vbabka@...e.cz>,
William Kucharski <william.kucharski@...cle.com>,
Arnd Bergmann <arnd@...db.de>,
Nathan Chancellor <nathan@...nel.org>, netdev@...r.kernel.org,
linux-mm@...ck.org, linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] niu: Silence randstruct warnings
On Wed, May 11, 2022 at 03:16:47PM -0700, Jakub Kicinski wrote:
> On Tue, 10 May 2022 13:57:29 -0700 Kees Cook wrote:
> > Clang randstruct gets upset when it sees struct addresspace (which is
> > randomized) being assigned to a struct page (which is not randomized):
> >
> > drivers/net/ethernet/sun/niu.c:3385:12: error: casting from randomized structure pointer type 'struct address_space *' to 'struct page *'
> > *link = (struct page *) page->mapping;
> > ^
> >
> > It looks like niu.c is looking for an in-line place to chain its allocated
> > pages together and is overloading the "mapping" member, as it is unused.
> > This is very non-standard, and is expected to be cleaned up in the
> > future[1], but there is no "correct" way to handle it today.
> >
> > No meaningful machine code changes result after this change, and source
> > readability is improved.
> >
> > Drop the randstruct exception now that there is no "confusing" cross-type
> > assignment.
> >
> > [1] https://lore.kernel.org/lkml/YnqgjVoMDu5v9PNG@casper.infradead.org/
> >
> > Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>
> > Cc: Christoph Hellwig <hch@...radead.org>
> > Cc: "David S. Miller" <davem@...emloft.net>
> > Cc: Jakub Kicinski <kuba@...nel.org>
> > Cc: Paolo Abeni <pabeni@...hat.com>
> > Cc: Du Cheng <ducheng2@...il.com>
> > Cc: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> > Cc: Vlastimil Babka <vbabka@...e.cz>
> > Cc: William Kucharski <william.kucharski@...cle.com>
> > Cc: Arnd Bergmann <arnd@...db.de>
> > Cc: Nathan Chancellor <nathan@...nel.org>
> > Cc: netdev@...r.kernel.org
> > Cc: linux-mm@...ck.org
> > Cc: linux-hardening@...r.kernel.org
> > Signed-off-by: Kees Cook <keescook@...omium.org>
>
> I presume you prefer to take this one via your tree too, so:
Yeah, that's easiest for the exception removals.
> Acked-by: Jakub Kicinski <kuba@...nel.org>
Thanks!
--
Kees Cook
Powered by blists - more mailing lists