All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH] x86emul/fuzz: extend canonicalization to 57-bit linear address width case
Date: Mon, 01 Apr 2019 01:42:49 -0600	[thread overview]
Message-ID: <5CA1C0F902000078002236A3@prv1-mh.provo.novell.com> (raw)

Don't enforce any other dependencies for now, just like we don't enforce
e.g. PAE enabled as a prereq for long mode.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
+++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
@@ -662,21 +662,21 @@ static void set_sizes(struct x86_emulate
     }
 }
 
-#define CANONICALIZE(x)                                   \
+#define CANONICALIZE(x, bits)                             \
     do {                                                  \
         uint64_t _y = (x);                                \
-        if ( _y & (1ULL << 47) )                          \
-            _y |= (~0ULL) << 48;                          \
+        if ( _y & (1ULL << ((bits) - 1)) )                \
+            _y |= (~0ULL) << (bits);                      \
         else                                              \
-            _y &= (1ULL << 48)-1;                         \
+            _y &= (1ULL << (bits)) - 1;                   \
         printf("Canonicalized %" PRIx64 " to %" PRIx64 "\n", x, _y);    \
         (x) = _y;                                       \
     } while( 0 )
 
-/* Expects bitmap and regs to be defined */
+/* Expects bitmap, regs, and c to be defined */
 #define CANONICALIZE_MAYBE(reg)                       \
     if ( !(bitmap & (1 << CANONICALIZE_##reg)) )      \
-        CANONICALIZE(regs->reg);                      \
+        CANONICALIZE(regs->reg, c->cr[4] & X86_CR4_LA57 ? 57 : 48); \
 
 enum {
     HOOK_read,
--- a/xen/include/asm-x86/x86-defns.h
+++ b/xen/include/asm-x86/x86-defns.h
@@ -64,6 +64,7 @@
 #define X86_CR4_OSFXSR     0x00000200 /* enable fast FPU save and restore */
 #define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */
 #define X86_CR4_UMIP       0x00000800 /* enable UMIP */
+#define X86_CR4_LA57       0x00001000 /* enable 5-level paging */
 #define X86_CR4_VMXE       0x00002000 /* enable VMX */
 #define X86_CR4_SMXE       0x00004000 /* enable SMX */
 #define X86_CR4_FSGSBASE   0x00010000 /* enable {rd,wr}{fs,gs}base */





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             reply	other threads:[~2019-04-01  7:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01  7:42 Jan Beulich [this message]
     [not found] ` <5CA1C0F902000000001041A4@prv1-mh.provo.novell.com>
     [not found]   ` <5CA1C0F90200007800232A7A@prv1-mh.provo.novell.com>
2019-05-27  9:26     ` Ping: [PATCH] x86emul/fuzz: extend canonicalization to 57-bit linear address width case Jan Beulich
2019-05-27  9:26       ` [Xen-devel] " Jan Beulich
2019-05-27 10:21 ` George Dunlap
2019-05-27 10:21   ` [Xen-devel] " George Dunlap

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=5CA1C0F902000078002236A3@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wei.liu2@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.