From: David Rientjes <rientjes@google.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>,
kernel test robot <oliver.sang@intel.com>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>,
oe-lkp@lists.linux.dev, lkp@intel.com,
Mike Rapoport <rppt@linux.ibm.com>,
Christoph Lameter <cl@linux.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: A better dump_page()
Date: Tue, 3 Jan 2023 15:07:12 -0800 (PST) [thread overview]
Message-ID: <c022ddc3-1cbd-8291-68a3-f90ffb93af84@google.com> (raw)
In-Reply-To: <Y7RKX45mvwkbiMbo@casper.infradead.org>
On Tue, 3 Jan 2023, Matthew Wilcox wrote:
> On Tue, Jan 03, 2023 at 11:42:11AM +0100, Vlastimil Babka wrote:
> > Separately we should also make the __dump_page() more resilient.
>
> Right. It's not ideal when one of our best debugging tools obfuscates
> the problem we're trying to debug. I've seen probems like this before,
> and the problem is that somebody calls dump_page() on a page that they
> don't own a refcount on. That lets the page mutate under us in some
> fairly awkward ways (as you've seen here, it seems to be part of several
> different compound allocations at various points during the dump
> process).
>
> One possibility I thought about was taking our own refcount on the
> page at the start of dump_page(). That would kill off the possibility
> of ever passing in a const struct page, and it would confuse people.
> Also, what if somebody passes in a pointer to something that's not a
> struct page? Then we've (tried to) modify memory that's not a refcount.
>
> I think the best we can do is to snapshot the struct page and the folio
> it appears to belong to at the start of dump_page(). It'll take a
> little care (for example, folio_pfn() must be passed the original
> folio, and not the snapshot), but I think it's doable.
>
By snapshot do you mean memcpy() of the metadata to the stack? I assume
this still leaves the opportunity for the underlying mutation of the page
but makes the window more narrow.
next prev parent reply other threads:[~2023-01-03 23:07 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 15:26 [linus:master] [mm, slub] 0af8489b02: kernel_BUG_at_include/linux/mm.h kernel test robot
2023-01-01 5:30 ` Hyeonggon Yoo
2023-01-01 6:50 ` Hyeonggon Yoo
2023-01-01 7:37 ` supervisor write access in kernel mode in __pv_queued_spin_unlock_slowpath Hyeonggon Yoo
2023-01-01 11:08 ` Maxim Levitsky
2023-01-02 11:17 ` Hyeonggon Yoo
2023-01-03 10:42 ` [linus:master] [mm, slub] 0af8489b02: kernel_BUG_at_include/linux/mm.h Vlastimil Babka
2023-01-03 13:46 ` Oliver Sang
2023-01-03 14:36 ` Vlastimil Babka
2023-01-04 9:04 ` Hyeonggon Yoo
2023-01-05 1:46 ` Oliver Sang
2023-01-05 13:59 ` Hyeonggon Yoo
2023-01-05 14:47 ` Hyeonggon Yoo
2023-01-09 14:16 ` Oliver Sang
2023-01-06 10:13 ` Vlastimil Babka
2023-01-09 14:01 ` Oliver Sang
2023-01-09 14:04 ` Oliver Sang
2023-01-10 13:53 ` Oliver Sang
2023-01-10 14:09 ` Vlastimil Babka
2023-01-11 2:26 ` Feng Tang
2023-01-11 10:52 ` Vlastimil Babka
2023-01-12 7:47 ` Oliver Sang
2023-01-12 7:56 ` Vlastimil Babka
2023-01-17 7:19 ` Oliver Sang
2023-01-12 8:49 ` Vlastimil Babka
2023-01-03 15:31 ` A better dump_page() Matthew Wilcox
2023-01-03 23:07 ` David Rientjes [this message]
2023-01-03 23:29 ` Matthew Wilcox
2023-01-05 15:19 ` Vlastimil Babka
2023-01-05 15:35 ` Matthew Wilcox
2023-01-06 17:28 ` [linus:master] [mm, slub] 0af8489b02: kernel_BUG_at_include/linux/mm.h Hyeonggon Yoo
2023-01-11 9:44 ` BUG: unable to handle page fault for address: f6ffe000 Hyeonggon Yoo
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=c022ddc3-1cbd-8291-68a3-f90ffb93af84@google.com \
--to=rientjes@google.com \
--cc=42.hyeyoo@gmail.com \
--cc=cl@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=rppt@linux.ibm.com \
--cc=vbabka@suse.cz \
--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