From: Demi Marie Obenour <demi@invisiblethingslab.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
"Jun Nakajima" <jun.nakajima@intel.com>,
"Kevin Tian" <kevin.tian@intel.com>,
"George Dunlap" <george.dunlap@citrix.com>,
"Tim Deegan" <tim@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v5 09/10] x86/mm: Reject invalid cacheability in PV guests by default
Date: Thu, 22 Dec 2022 04:55:45 -0500 [thread overview]
Message-ID: <Y6QppKYFkKqyo3cS@itl-email> (raw)
In-Reply-To: <a73a6829-5924-a98a-704b-c0111c16a3f1@suse.com>
[-- Attachment #1: Type: text/plain, Size: 3092 bytes --]
On Thu, Dec 22, 2022 at 10:48:02AM +0100, Jan Beulich wrote:
> On 20.12.2022 02:07, Demi Marie Obenour wrote:
> > --- a/xen/arch/x86/mm.c
> > +++ b/xen/arch/x86/mm.c
> > @@ -145,6 +145,8 @@
> >
> > #ifdef CONFIG_PV
> > #include "pv/mm.h"
> > +bool allow_invalid_cacheability;
>
> static and __ro_after_init please (the former not the least with Misra
> in mind).
Will fix in v6.
> > +boolean_param("allow_invalid_cacheability", allow_invalid_cacheability);
> > #endif
>
> Any new command line option will need to come with an entry in
> docs/misc/xen-command-line.pandoc. Furthermore we're trying to avoid
> underscores in command line option names, when dashes serve the
> purpose quite fine.
Will fix in v6.
> Also please add a blank line at least between #include and your
> addition. Personally I would find it more natural if such a single-use
> control was defined next to the place it is used, i.e.
Will fix in v6.
> > @@ -1343,7 +1345,33 @@ static int promote_l1_table(struct page_info *page)
> > }
> > else
> > {
>
> ... here.
Will move in v6.
> > - switch ( ret = get_page_from_l1e(pl1e[i], d, d) )
> > + l1_pgentry_t l1e = pl1e[i];
> > +
> > + if ( !allow_invalid_cacheability )
> > + {
> > + switch ( l1e.l1 & PAGE_CACHE_ATTRS )
> > + {
> > + case _PAGE_WB:
> > + case _PAGE_UC:
> > + case _PAGE_UCM:
> > + case _PAGE_WC:
> > + case _PAGE_WT:
> > + case _PAGE_WP:
> > + break;
> > + default:
>
> Nit (style): Blank line please between non-fall-through case blocks.
Will fix in v6.
> > + /*
> > + * If we get here, a PV guest tried to use one of the
> > + * reserved values in Xen's PAT. This indicates a bug in
> > + * the guest, so inject #GP to cause the guest to log a
> > + * stack trace.
> > + */
>
> And likely make it die. Which, yes, ...
>
> > + pv_inject_hw_exception(TRAP_gp_fault, 0);
> > + ret = -EINVAL;
>
> ... also may or may not be the result of returning failure here (if the
> guest "checks" for errors by using a BUG()-like construct), but that's
> then more of its own fault than not coping with a non-architectural #GP.
Is there really any architectural behavior here?
> Also wasn't there talk of having this behavior in debug hypervisors
> only? Without that restriction I'm yet less happy with the change ...
My understanding was that Andrew preferred the behavior to be turned on
in release hypervisors too. I am inclined to agree with Andrew, if for
no other reason than that those working on guest OSs do not generally
use debug hypervisors if they are not also working on Xen itself.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-12-22 9:56 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 1:07 [PATCH v5 00/10] Make PAT handling less brittle Demi Marie Obenour
2022-12-20 1:07 ` [PATCH v5 01/10] x86: Add memory type constants Demi Marie Obenour
2022-12-20 1:07 ` [PATCH v5 02/10] x86/mm: Avoid hard-coding PAT in get_page_from_l1e() Demi Marie Obenour
2022-12-20 8:19 ` Jan Beulich
2022-12-22 9:51 ` Jan Beulich
2022-12-22 9:58 ` Demi Marie Obenour
2022-12-20 1:07 ` [PATCH v5 03/10] x86: Replace PAT_* with X86_MT_* Demi Marie Obenour
2022-12-20 1:07 ` [PATCH v5 04/10] x86: Replace MTRR_* constants with X86_MT_* constants Demi Marie Obenour
2022-12-20 1:07 ` [PATCH v5 05/10] x86: Replace EPT_EMT_* constants with X86_MT_* Demi Marie Obenour
2022-12-20 8:21 ` Jan Beulich
2022-12-20 1:07 ` [PATCH v5 06/10] x86: Remove MEMORY_NUM_TYPES and NO_HARDCODE_MEM_TYPE Demi Marie Obenour
2022-12-20 1:07 ` [PATCH v5 07/10] x86: Derive XEN_MSR_PAT from its individual entries Demi Marie Obenour
2022-12-20 1:07 ` [PATCH v5 08/10] x86/mm: make code robust to future PAT changes Demi Marie Obenour
2022-12-22 9:35 ` Jan Beulich
2022-12-22 9:50 ` Demi Marie Obenour
2022-12-22 9:54 ` Jan Beulich
2022-12-22 10:00 ` Demi Marie Obenour
2022-12-22 10:03 ` Jan Beulich
2022-12-20 1:07 ` [PATCH v5 09/10] x86/mm: Reject invalid cacheability in PV guests by default Demi Marie Obenour
2022-12-22 9:48 ` Jan Beulich
2022-12-22 9:55 ` Demi Marie Obenour [this message]
2022-12-22 10:06 ` Jan Beulich
2022-12-20 1:07 ` [PATCH v5 10/10] x86: Use Linux's PAT Demi Marie Obenour
2022-12-20 16:13 ` [PATCH v5 11/10] hvmloader: use memory type constants Jan Beulich
2022-12-20 16:36 ` Andrew Cooper
2022-12-20 16:50 ` Jan Beulich
2022-12-20 17:45 ` Demi Marie Obenour
2022-12-21 6:56 ` Jan Beulich
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=Y6QppKYFkKqyo3cS@itl-email \
--to=demi@invisiblethingslab.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=marmarek@invisiblethingslab.com \
--cc=roger.pau@citrix.com \
--cc=tim@xen.org \
--cc=wl@xen.org \
--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.