id = 1372 title = "x86 BEXTR semantic bug" state = "closed" created_at = "2022-12-16T06:51:11.166Z" closed_at = "2023-02-16T13:09:22.647Z" labels = ["Closed::Fixed", "accel: TCG", "target: i386"] url = "https://gitlab.com/qemu-project/qemu/-/issues/1372" host-os = "Windows 10 20H2" host-arch = "x86" qemu-version = "7.1.90 (v7.2.0-rc0)" guest-os = "None" guest-arch = "x86" description = """The result of instruction BEXTR is different with from the CPU. The value of destination register is different. I think QEMU does not consider the operand size limit.""" reproduce = """1. Compile this code ``` void main() { asm("mov rax, 0x17b3693f77fb6e9"); asm("mov rbx, 0x8f635a775ad3b9b4"); asm("mov rcx, 0xb717b75da9983018"); asm("bextr eax, ebx, ecx"); } ``` 2. Execute and compare the result with the CPU. - CPU - RAX = 0x5a - QEMU - RAX = 0x635a775a""" additional = """This bug is discovered by research conducted by KAIST SoftSec."""