All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] x86/boot: Further simplify CR4 handling in dom0_construct_pv()
Date: Fri, 4 Oct 2024 09:40:12 +0200	[thread overview]
Message-ID: <Zv-b3IP_RvCsY81q@macbook.local> (raw)
In-Reply-To: <7dbd7fae-e2e8-4508-a012-cf9b719c68f1@suse.com>

On Fri, Oct 04, 2024 at 08:52:52AM +0200, Jan Beulich wrote:
> On 03.10.2024 01:20, Andrew Cooper wrote:
> > The logic would be more robust disabling SMAP based on its precense in CR4,
> > rather than SMAP's accociation with a synthetic feature.
> 
> It's hard to tell what's more robust without knowing what future changes
> there might be. In particular ...
> 
> > @@ -1064,19 +1065,19 @@ int __init dom0_construct_pv(struct domain *d,
> >       * prevents us needing to write construct_dom0() in terms of
> >       * copy_{to,from}_user().
> >       */
> > -    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
> > +    if ( cr4 & X86_CR4_SMAP )
> 
> ... with this adjustment ...
> 
> >      {
> >          if ( IS_ENABLED(CONFIG_PV32) )
> >              cr4_pv32_mask &= ~X86_CR4_SMAP;
> 
> ... this update of a global no longer occurs. Playing games with CR4
> elsewhere might run into issues with this lack of updating.

Maybe we should assert the state of cr4 is as expected?

ASSERT(!boot_cpu_has(X86_FEATURE_XEN_SMAP) || (cr4 & X86_CR4_SMAP));

Thanks, Roger.


  reply	other threads:[~2024-10-04  7:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 23:20 [PATCH] x86/boot: Further simplify CR4 handling in dom0_construct_pv() Andrew Cooper
2024-10-04  6:52 ` Jan Beulich
2024-10-04  7:40   ` Roger Pau Monné [this message]
2024-10-04 18:49   ` Andrew Cooper
2024-10-07  7:21     ` Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2024-09-24 11:23 Andrew Cooper
2024-09-24 12:30 ` Roger Pau Monné
2024-09-24 14:39   ` Andrew Cooper
2024-09-24 13:44 ` Jan Beulich
2024-09-24 14:30   ` Roger Pau Monné

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=Zv-b3IP_RvCsY81q@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.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.