]> xenbits.xensource.com Git - xen.git/commitdiff
x86emul/fuzz: adjust canonicalization in sanitize_input()
authorJan Beulich <jbeulich@suse.com>
Mon, 1 Apr 2019 09:12:16 +0000 (11:12 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 1 Apr 2019 09:12:16 +0000 (11:12 +0200)
Drop it entirely for %rbp - this register is not special purpose enough
to warrant such special treatment. Add a comment to clarify the purpose
of the canonicalization of %rip and %rsp.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/fuzz/x86_instruction_emulator/fuzz-emul.c

index 0ffd0fbfe1cdde2d8e7f1783dea2d8ea67872b68..8ab3626f5eb140cd6f10cf79075bca81ce61e99c 100644 (file)
@@ -708,7 +708,6 @@ enum {
     HOOK_vmfunc,
     CANONICALIZE_rip,
     CANONICALIZE_rsp,
-    CANONICALIZE_rbp
 };
 
 /* Expects bitmap to be defined */
@@ -785,9 +784,13 @@ static void sanitize_input(struct x86_emulate_ctxt *ctxt)
     regs->error_code = 0;
     regs->entry_vector = 0;
 
+    /*
+     * For both RIP and RSP make sure we test with canonical values in at
+     * least a fair number of cases. As all other registers aren't tied to
+     * special addressing purposes, leave everything else alone.
+     */
     CANONICALIZE_MAYBE(rip);
     CANONICALIZE_MAYBE(rsp);
-    CANONICALIZE_MAYBE(rbp);
 
     /*
      * CR0.PG can't be set if CR0.PE isn't set.  Set is more interesting, so