From: "Alejandro Vallejo" <alejandro.vallejo@cloud.com>
To: "Jan Beulich" <jbeulich@suse.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v2] x86/traps: Re-enable interrupts after reading cr2 in the #PF handler
Date: Fri, 27 Sep 2024 15:21:35 +0100 [thread overview]
Message-ID: <D4H4TG3ER5U7.3JP6GUHTDXOHM@cloud.com> (raw)
In-Reply-To: <208589d3-aff2-414b-8bbd-89d0753f346a@suse.com>
On Wed Sep 25, 2024 at 7:35 AM BST, Jan Beulich wrote:
> On 24.09.2024 20:36, Andrew Cooper wrote:
> > On 23/09/2024 2:03 pm, Jan Beulich wrote:
> >> On 23.09.2024 12:14, Alejandro Vallejo wrote:
> >>> On Fri Sep 20, 2024 at 3:12 PM BST, Roger Pau Monné wrote:
> >>>> On Wed, Sep 18, 2024 at 02:05:54PM +0100, Alejandro Vallejo wrote:
> >>>>> Moves sti directly after the cr2 read and immediately after the #PF
> >>>>> handler.
> >>>> I think you need to add some context about why this is needed, iow:
> >>>> avoid corrupting %cr2 if a nested 3PF happens.
> >>> I can send a v3 with:
> >>>
> >>> ```
> >>> Hitting a page fault clobbers %cr2, so if a page fault is handled while
> >>> handling a previous page fault then %cr2 will hold the address of the latter
> >>> fault rather than the former. This patch makes the page fault path delay
> >>> re-enabling IRQs until %cr2 has been read in order to ensure it stays
> >>> consistent.
> >> And under what conditions would we experience #PF while already processing
> >> an earlier #PF? If an interrupt kicks in, that's not supposed to by raising
> >> any #PF itself. Which isn't to say that the change isn't worthwhile to make,
> >> but it would be nice if it was explicit whether there are active issues, or
> >> whether this is merely to be on the safe side going forward.
> >
> > My understanding is that this came from code inspection, not an active
> > issue.
> >
> > The same is true for %dr6 and #DB, and MSR_XFD_ERR and #NM.
> >
> > I think we can safely agree to veto the use of AMX in the #NM handler,
> > and IST exceptions don't re-enable interrupts[1], so #PF is the only
> > problem case.
> >
> > Debug keys happen off the back of plain IRQs, and we can get #PF when
> > interrogating guest stacks.
>
> Hmm, yes, this looks like a case that is actively being fixed here. Wants
> mentioning, likely wants a respective Fixes: tag, and then also wants
> backporting.
Sure.
>
> > Also, I'm far from certain we're safe to
> > spurious #PF's from updating Xen mappings, so I think there are a bunch
> > of risky corner cases that we might be exposed to.
>
> Spurious #PF are possible, but __page_fault_type() explicitly excludes
> the in_irq() case.
>
> Jan
Cheers,
Alejandro
next prev parent reply other threads:[~2024-09-27 14:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 13:05 [PATCH v2] x86/traps: Re-enable interrupts after reading cr2 in the #PF handler Alejandro Vallejo
2024-09-20 14:12 ` Roger Pau Monné
2024-09-23 10:14 ` Alejandro Vallejo
2024-09-23 13:03 ` Jan Beulich
2024-09-24 18:36 ` Andrew Cooper
2024-09-25 6:35 ` Jan Beulich
2024-09-25 7:49 ` Andrew Cooper
2024-09-27 14:21 ` Alejandro Vallejo [this message]
2024-09-27 13:41 ` Alejandro Vallejo
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=D4H4TG3ER5U7.3JP6GUHTDXOHM@cloud.com \
--to=alejandro.vallejo@cloud.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.