From: Matthew Wilcox <willy@infradead.org>
To: Jason Andryuk <jandryuk@gmail.com>
Cc: bugzilla-daemon@bugzilla.kernel.org, akpm@linux-foundation.org,
linux-mm@kvack.org, labbott@redhat.com
Subject: Re: [Bug 198497] handle_mm_fault / xen_pmd_val / radix_tree_lookup_slot Null pointer
Date: Fri, 20 Apr 2018 06:39:51 -0700 [thread overview]
Message-ID: <20180420133951.GC10788@bombadil.infradead.org> (raw)
In-Reply-To: <CAKf6xpuYvCMUVHdP71F8OWm=bQGFxeRd7SddH-5DDo-AQjbbQg@mail.gmail.com>
On Fri, Apr 20, 2018 at 09:10:11AM -0400, Jason Andryuk wrote:
> > Given that this is happening on Xen, I wonder if Xen is using some of the
> > bits in the page table for its own purposes.
>
> The backtraces include do_swap_page(). While I have a swap partition
> configured, I don't think it's being used. Are we somehow
> misidentifying the page as a swap page? I'm not familiar with the
> code, but is there an easy way to query global swap usage? That way
> we can see if the check for a swap page is bogus.
>
> My system works with the band-aid patch. When that patch sets page =
> NULL, does that mean userspace is just going to get a zero-ed page?
> Userspace still works AFAICT, which makes me think it is a
> mis-identified page to start with.
Here's how this code works.
When we swap out an anonymous page (a page which is not backed by a
file; could be from a MAP_PRIVATE mapping, could be brk()), we write it
to the swap cache. In order to be able to find it again, we store a
cookie (called a swp_entry_t) in the process' page table (marked with
the 'present' bit clear, so the CPU will fault on it). When we get a
fault, we look up the cookie in a radix tree and bring that page back
in from swap.
If there's no page found in the radix tree, we put a freshly zeroed
page into the process's address space. That's because we won't find
a page in the swap cache's radix tree for the first time we fault.
It's not an indication of a bug if there's no page to be found.
What we're seeing for this bug is page table entries of the format
0x8000'0004'0000'0000. That would be a zeroed entry, except for the
fact that something's stepped on the upper bits.
What is worrying is that potentially Xen might be stepping on the upper
bits of either a present entry (leading to the process loading a page
that belongs to someone else) or an entry which has been swapped out,
leading to the process getting a zeroed page when it should be getting
its page back from swap.
Defending against this kind of corruption would take adding a parity
bit to the page tables. That's not a project I have time for right now.
next prev parent reply other threads:[~2018-04-20 13:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-198497-200779@https.bugzilla.kernel.org/>
[not found] ` <bug-198497-200779-43rwxa1kcg@https.bugzilla.kernel.org/>
2018-04-20 13:10 ` Jason Andryuk
2018-04-20 13:39 ` Matthew Wilcox [this message]
2018-04-20 15:20 ` Jason Andryuk
2018-04-20 15:25 ` [Xen-devel] " Andrew Cooper
2018-04-20 15:40 ` Andrew Cooper
2018-04-20 15:42 ` Jan Beulich
2018-04-20 15:52 ` Jason Andryuk
2018-04-20 16:00 ` Andrew Cooper
2018-04-20 16:02 ` Jan Beulich
2018-04-20 19:20 ` Boris Ostrovsky
2018-04-21 6:17 ` Juergen Gross
2018-04-21 14:35 ` Matthew Wilcox
2018-04-22 5:50 ` Juergen Gross
2018-04-23 8:17 ` Juergen Gross
2018-09-04 12:54 ` Jason Andryuk
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=20180420133951.GC10788@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=bugzilla-daemon@bugzilla.kernel.org \
--cc=jandryuk@gmail.com \
--cc=labbott@redhat.com \
--cc=linux-mm@kvack.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