]> www.infradead.org Git - users/dwmw2/linux.git/commit
mm: open-code PageTail in folio_flags() and const_folio_flags()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 25 Nov 2024 20:17:18 +0000 (20:17 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 6 Dec 2024 03:54:45 +0000 (19:54 -0800)
commit4de22b2a6a7477d84d9a01eb6b62a9117309d722
treeb619660a80f68f1427cb0c9005004f1139970bf9
parentd699440f58ce9bd71103cc7b692e3ab76a20bfcd
mm: open-code PageTail in folio_flags() and const_folio_flags()

It is unsafe to call PageTail() in dump_page() as page_is_fake_head() will
almost certainly return true when called on a head page that is copied to
the stack.  That will cause the VM_BUG_ON_PGFLAGS() in const_folio_flags()
to trigger when it shouldn't.  Fortunately, we don't need to call
PageTail() here; it's fine to have a pointer to a virtual alias of the
page's flag word rather than the real page's flag word.

Link: https://lkml.kernel.org/r/20241125201721.2963278-1-willy@infradead.org
Fixes: fae7d834c43c ("mm: add __dump_folio()")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Kees Cook <kees@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/page-flags.h