target/i386: fix bugs in emulation of BMI instructions
Summary of Changes
RHEL supports use of QEMU with the Tiny Code Generator (TCG) instead of KVM in specific cases, such as running the libguestfs appliances in a VM without nested virtualization enabled. In this case, libguestfs uses the "-cpu max" CPU model which uses all the instructions that TCG is able to emulate.
QEMU 7.2 included a rewrite of SSE and BMI instructions that unfortunately had a few bugs. Because of the "-cpu max" CPU model, these instructions are always enabled.
The most common symptom is failure to do cryptographic operations, for example (without libguestfs) "curl" of an https URL will fail due to a bug in the ADCX and ADOX instructions. Because the issue is in the translation of x86 instructions, it is impossible to provide a full set of affected programs; on the other hand, the patch is very safe because it only affects TCG and more specifically only the buggy instructions.
Approved Bugzilla Ticket
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2173590
Upstream status: merged