Skip to contentSkip to conversation

i386: hvf: Fix overrun of _decode_tbl1

PATCH Applied Roman Bolshakov 2 participants 4 messages Dec 3, 2018 – Dec 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 i386: hvf: Fix overrun of _decode_tbl1

Single opcode instructions in ff group were incorrectly processed because an overrun of _decode_tbl1[0xff] resulted in access of _decode_tbl2[0x0]. Thus, decode_sldtgroup was called instead of decode_ffgroup:
7d71: decode_sldtgroup: 1
Unimplemented handler (7d71) for 108 (ff 0)

While at it correct maximum length for _decode_tbl2 and _decode_tbl3.

---
 target/i386/hvf/x86_decode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
target/i386/hvf/x86_decode.c +3 -3
index 2e33b69541..d125a6ef83 100644
@@ -454,9 +454,9 @@ struct decode_x87_tbl {
 struct decode_tbl invl_inst = {0x0, 0, 0, false, NULL, NULL, NULL, NULL,
                                decode_invalid};
 
-struct decode_tbl _decode_tbl1[255];
-struct decode_tbl _decode_tbl2[255];
-struct decode_x87_tbl _decode_tbl3[255];
+struct decode_tbl _decode_tbl1[256];
+struct decode_tbl _decode_tbl2[256];
+struct decode_x87_tbl _decode_tbl3[256];
 
 static void decode_x87_ins(CPUX86State *env, struct x86_decode *decode)
 {
Signature · 1 line
2.17.2 (Apple Git-113)
#1 lore raw

PATCH 2/2 i386: hvf: drop debug printf in decode_sldtgroup

It's going to clutter QEMU logs if 0x0f00 is trapped.

---
 target/i386/hvf/x86_decode.c | 2 --
 1 file changed, 2 deletions(-)
target/i386/hvf/x86_decode.c +0 -2
index d125a6ef83..5f513c5563 100644
@@ -525,8 +525,6 @@ static void decode_sldtgroup(CPUX86State *env, struct x86_decode *decode)
         X86_DECODE_CMD_INVL
     };
     decode->cmd = group[decode->modrm.reg];
-    printf("%llx: decode_sldtgroup: %d\n", env->hvf_emul->fetch_rip,
-            decode->modrm.reg);
 }
 
 static void decode_lidtgroup(CPUX86State *env, struct x86_decode *decode)
Signature · 1 line
2.17.2 (Apple Git-113)
#2 lore raw

Re: [Qemu-devel] [PATCH for-3.1 2/2] i386: hvf: drop debug printf in decode_sldtgroup

Quoted 23 lines · Roman Bolshakov

It's going to clutter QEMU logs if 0x0f00 is trapped.

---
 target/i386/hvf/x86_decode.c | 2 --
 1 file changed, 2 deletions(-)
target/i386/hvf/x86_decode.c +0 -2
index d125a6ef83..5f513c5563 100644
@@ -525,8 +525,6 @@ static void decode_sldtgroup(CPUX86State *env, struct x86_decode *decode)
         X86_DECODE_CMD_INVL
     };
     decode->cmd = group[decode->modrm.reg];
-    printf("%llx: decode_sldtgroup: %d\n", env->hvf_emul->fetch_rip,
-            decode->modrm.reg);
 }
 
 static void decode_lidtgroup(CPUX86State *env, struct x86_decode *decode)
Signature · 1 line
2.17.2 (Apple Git-113)

Could you please apply to trivial queue?

Thank you,
Roman

#3 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH for-3.1 2/2] i386: hvf: drop debug printf in decode_sldtgroup

Quoted 20 lines · Roman Bolshakov
Quoted 19 lines · Roman Bolshakov

It's going to clutter QEMU logs if 0x0f00 is trapped.

---
 target/i386/hvf/x86_decode.c | 2 --
 1 file changed, 2 deletions(-)
target/i386/hvf/x86_decode.c +0 -2
index d125a6ef83..5f513c5563 100644
@@ -525,8 +525,6 @@ static void decode_sldtgroup(CPUX86State *env, struct x86_decode *decode)
         X86_DECODE_CMD_INVL
     };
     decode->cmd = group[decode->modrm.reg];
-    printf("%llx: decode_sldtgroup: %d\n", env->hvf_emul->fetch_rip,
-            decode->modrm.reg);
 }
 
Quoted 6 lines
Quoted 4 lines
target/i386/hvf/x86_decode.c +0 -0
 static void decode_lidtgroup(CPUX86State *env, struct x86_decode *decode)
Signature · 1 line
2.17.2 (Apple Git-113)

Could you please apply to trivial queue

Applied to my trivial-patches branch.

Thanks,
Laurent