From: Jason Andryuk <jandryuk@gmail.com>
To: Juergen Gross <jgross@suse.com>
Cc: Matthew Wilcox <willy@infradead.org>,
bugzilla-daemon@bugzilla.kernel.org, akpm@linux-foundation.org,
linux-mm@kvack.org, labbott@redhat.com, xen-devel@lists.xen.org,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [Bug 198497] handle_mm_fault / xen_pmd_val / radix_tree_lookup_slot Null pointer
Date: Tue, 4 Sep 2018 08:54:31 -0400 [thread overview]
Message-ID: <CAKf6xpuaBRQRaM-UV9T1b6McR984U8RtXNg5+1v8MLm5Dp1A+w@mail.gmail.com> (raw)
In-Reply-To: <f10cdd77-2fe2-2003-4cac-dfec50f0ee43@suse.com>
On Mon, Apr 23, 2018 at 4:17 AM Juergen Gross <jgross@suse.com> wrote:
> On 20/04/18 17:20, Jason Andryuk wrote:
> > Adding xen-devel and the Linux Xen maintainers.
> >
> > Summary: Some Xen users (and maybe others) are hitting a BUG in
> > __radix_tree_lookup() under do_swap_page() - example backtrace is
> > provided at the end. Matthew Wilcox provided a band-aid patch that
> > prints errors like the following instead of triggering the bug.
> >
> > Skylake 32bit PAE Dom0:
> > Bad swp_entry: 80000000
> > mm/swap_state.c:683: bad pte d3a39f1c(8000000400000000)
> >
> > Ivy Bridge 32bit PAE Dom0:
> > Bad swp_entry: 40000000
> > mm/swap_state.c:683: bad pte d3a05f1c(8000000200000000)
> >
> > Other 32bit DomU:
> > Bad swp_entry: 4000000
> > mm/swap_state.c:683: bad pte e2187f30(8000000200000000)
> >
> > Other 32bit:
> > Bad swp_entry: 2000000
> > mm/swap_state.c:683: bad pte ef3a3f38(8000000100000000)
> >
> > The Linux bugzilla has more info
> > https://bugzilla.kernel.org/show_bug.cgi?id=198497
> >
> > This may not be exclusive to Xen Linux, but most of the reports are on
> > Xen. Matthew wonders if Xen might be stepping on the upper bits of a
> > pte.
> >
<snip>
>
> Could it be we just have a race regarding pte_clear()? This will set
> the low part of the pte to zero first and then the hight part.
>
> In case pte_clear() is used in interrupt mode especially Xen will be
> rather slow as it emulates the two writes to the page table resulting
> in a larger window where the race might happen.
It looks like Juergen was correct. With the L1TF vulnerability, the
Xen hypervisor needs to detect vulnerable PTEs. For 32bit PAE, Xen
would trap on PTEs like 0x8000'0002'0000'0000 - the same format as
seen in this bug. He wrote two patches for Linux, now upstream, to
write PTEs with 64bit operations or hypercalls and avoid the invalid
PTEs:
f7c90c2aa400 "x86/xen: don't write ptes directly in 32-bit PV guests"
b2d7a075a1cc "x86/pae: use 64 bit atomic xchg function in
native_ptep_get_and_clear"
With those patches, I have not seen a "Bad swp_entry", so this seems
fixed for me on Xen.
There was also a report of a non-Xen kernel being affected. Is there
an underlying problem that native PAE code updates PTEs in two writes,
but there is no locking to prevent the intermediate PTE from being
used elsewhere in the kernel?
Regards,
Jason
prev parent reply other threads:[~2018-09-04 12:54 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
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 [this message]
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=CAKf6xpuaBRQRaM-UV9T1b6McR984U8RtXNg5+1v8MLm5Dp1A+w@mail.gmail.com \
--to=jandryuk@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=boris.ostrovsky@oracle.com \
--cc=bugzilla-daemon@bugzilla.kernel.org \
--cc=jgross@suse.com \
--cc=labbott@redhat.com \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
--cc=xen-devel@lists.xen.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