xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH] x86/compat: correct SMEP/SMAP NOPs patching
Date: Wed, 25 May 2016 17:03:43 +0100	[thread overview]
Message-ID: <20160525160343.GT22076@citrix.com> (raw)
In-Reply-To: <5745DA4102000078000EEBF5@prv-mh.provo.novell.com>

On Wed, May 25, 2016 at 09:00:49AM -0600, Jan Beulich wrote:
> Correct the number of single byte NOPs we want to be replaced in case
> neither SMEP nor SMAP are available.
> 
> Also simplify the expression adding these NOPs - at that location .
> equals .Lcr4_orig, and removing that part of the expression fixes a
> bogus ".space or fill with negative value, ignored" warning by very old
> gas (which actually is what made me look at those constructs again).
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/x86/x86_64/compat/entry.S
> +++ b/xen/arch/x86/x86_64/compat/entry.S
> @@ -175,7 +175,7 @@ compat_bad_hypercall:
>  ENTRY(compat_restore_all_guest)
>          ASSERT_INTERRUPTS_DISABLED
>  .Lcr4_orig:
> -        .skip (.Lcr4_alt_end - .Lcr4_alt) - (. - .Lcr4_orig), 0x90
> +        .skip .Lcr4_alt_end - .Lcr4_alt, 0x90
>  .Lcr4_orig_end:
>          .pushsection .altinstr_replacement, "ax"
>  .Lcr4_alt:
> @@ -200,7 +200,8 @@ ENTRY(compat_restore_all_guest)
>          jne   1b
>  .Lcr4_alt_end:
>          .section .altinstructions, "a"
> -        altinstruction_entry .Lcr4_orig, .Lcr4_orig, X86_FEATURE_ALWAYS, 12, 0
> +        altinstruction_entry .Lcr4_orig, .Lcr4_orig, X86_FEATURE_ALWAYS, \
> +                             (.Lcr4_orig_end - .Lcr4_orig), 0
>          altinstruction_entry .Lcr4_orig, .Lcr4_alt, X86_FEATURE_SMEP, \
>                               (.Lcr4_orig_end - .Lcr4_orig), \
>                               (.Lcr4_alt_end - .Lcr4_alt)
> 
> 
> 

FWIW:
Reviewed-by: Wei Liu <wei.liu2@citrix.com>

And subject to review from Andrew:

Release-acked-by: Wei Liu <wei.liu2@citrix.com>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-05-25 16:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 15:00 [PATCH] x86/compat: correct SMEP/SMAP NOPs patching Jan Beulich
2016-05-25 16:03 ` Wei Liu [this message]
2016-05-26 10:41 ` Andrew Cooper
2016-05-27  8:01 ` 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=20160525160343.GT22076@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).