id = 1374 title = "x86 BZHI semantic bug" state = "closed" created_at = "2022-12-16T07:33:54.303Z" closed_at = "2023-02-28T15:08:49.405Z" labels = ["Closed::Fixed", "accel: TCG", "target: i386"] url = "https://gitlab.com/qemu-project/qemu/-/issues/1374" 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 BZHI is different from the CPU. The value of destination register and SF of EFLAGS are different.""" reproduce = """1. Compile this code ``` void main() { asm("mov rax, 0xb1aa9da2fe33fe3"); asm("mov rbx, 0x80000000ffffffff"); asm("mov rcx, 0xf3fce8829b99a5c6"); asm("bzhi rax, rbx, rcx"); } ``` 2. Execute and compare the result with the CPU. - CPU - RAX = 0x0x80000000ffffffff - SF = 1 - QEMU - RAX = 0xffffffff - SF = 0""" additional = """This bug is discovered by research conducted by KAIST SoftSec."""