From: Jakub Kicinski <kuba@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Christoph Hellwig <hch@infradead.org>,
"David S. Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>, Du Cheng <ducheng2@gmail.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Vlastimil Babka <vbabka@suse.cz>,
William Kucharski <william.kucharski@oracle.com>,
Arnd Bergmann <arnd@arndb.de>,
Nathan Chancellor <nathan@kernel.org>,
netdev@vger.kernel.org, linux-mm@kvack.org,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] niu: Silence randstruct warnings
Date: Wed, 11 May 2022 15:16:47 -0700 [thread overview]
Message-ID: <20220511151647.7290adbe@kernel.org> (raw)
In-Reply-To: <20220510205729.3574400-1-keescook@chromium.org>
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@infradead.org>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> Cc: Du Cheng <ducheng2@gmail.com>
> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: William Kucharski <william.kucharski@oracle.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: netdev@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-hardening@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
I presume you prefer to take this one via your tree too, so:
Acked-by: Jakub Kicinski <kuba@kernel.org>
next prev parent reply other threads:[~2022-05-11 22:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-10 20:57 [PATCH] niu: Silence randstruct warnings Kees Cook
2022-05-11 22:16 ` Jakub Kicinski [this message]
2022-05-11 23:25 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220511151647.7290adbe@kernel.org \
--to=kuba@kernel.org \
--cc=arnd@arndb.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=ducheng2@gmail.com \
--cc=hch@infradead.org \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nathan@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vbabka@suse.cz \
--cc=william.kucharski@oracle.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).