From: Kees Cook <kees@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] mm: Handle compound pages better in __dump_page()
Date: Sun, 17 Nov 2024 20:46:45 -0800 [thread overview]
Message-ID: <202411172043.C19A3963@keescook> (raw)
In-Reply-To: <Zzq-TJlSKXoo80Fo@casper.infradead.org>
On Mon, Nov 18, 2024 at 04:10:52AM +0000, Matthew Wilcox wrote:
> folio_test_large() does not touch page[1]. Look:
It does, though. :( It's via the PageTail(), which calls page_is_fake_head():
In function 'page_fixed_fake_head',
inlined from 'page_is_fake_head' at ../include/linux/page-flags.h:237:9,
inlined from 'PageTail' at ../include/linux/page-flags.h:281:47,
inlined from 'const_folio_flags' at ../include/linux/page-flags.h:309:2,
inlined from 'folio_test_head' at ../include/linux/page-flags.h:824:9,
inlined from 'folio_test_large' at ../include/linux/page-flags.h:845:9,
inlined from '__dump_page' at ../mm/debug.c:138:8:
../include/asm-generic/rwonce.h:44:26: error: array subscript 9 is outside array bounds of 'struct p
age[1]' [-Werror=array-bounds=]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
../include/linux/page-flags.h:221:38: note: in expansion of macro 'READ_ONCE'
221 | unsigned long head = READ_ONCE(page[1].compound_head);
| ^~~~~~~~~
../mm/debug.c: In function '__dump_page':
../mm/debug.c:126:21: note: at offset 72 into object 'precise' of size 64
126 | struct page precise;
| ^~~~~~~
> > Instead, explicitly make precise 2 pages. Just open-coding page_folio()
> > isn't sufficient to avoid the warning[1].
>
> Why not? What goes wrong? I'm trying to get gcc-15 installed here now
With your original patch applied, I get the above warning.
--
Kees Cook
next prev parent reply other threads:[~2024-11-18 4:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-17 5:52 Kees Cook
2024-11-18 4:10 ` Matthew Wilcox
2024-11-18 4:46 ` Kees Cook [this message]
2024-11-18 5:17 ` Matthew Wilcox
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=202411172043.C19A3963@keescook \
--to=kees@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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