Bug 2020186 - The QEMU emulator incorrectly interprets the contents of the SLIC table.
Summary: The QEMU emulator incorrectly interprets the contents of the SLIC table.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 36
Hardware: x86_64
OS: Windows
unspecified
high
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-04 10:02 UTC by Dmitry V. Orekhov
Modified: 2022-05-23 01:14 UTC (History)
11 users (show)

Fixed In Version: qemu-6.2.0-10.fc36
Clone Of:
Environment:
Last Closed: 2022-05-23 01:14:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
The SLIC table read on pure hardware and in a virtual machine in fedora 34 and fedora 35. (182.47 KB, image/png)
2021-11-04 10:02 UTC, Dmitry V. Orekhov
no flags Details
SLIC binary image (374 bytes, application/octet-stream)
2021-11-04 10:47 UTC, Dmitry V. Orekhov
no flags Details
Sertificate for Windows 7 activation (2.67 KB, application/xml)
2021-11-04 10:50 UTC, Dmitry V. Orekhov
no flags Details
Key for Windows 7 activation (30 bytes, text/plain)
2021-11-04 10:50 UTC, Dmitry V. Orekhov
no flags Details
Executable for reading SLIC under Windows 7 (336.00 KB, application/x-ms-dos-executable)
2021-11-04 10:51 UTC, Dmitry V. Orekhov
no flags Details
Working patch (639 bytes, patch)
2022-01-13 13:09 UTC, Dmitry V. Orekhov
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Gitlab qemu-project qemu issues 707 0 None None None 2021-11-04 11:56:00 UTC

Description Dmitry V. Orekhov 2021-11-04 10:02:50 UTC
Created attachment 1839834 [details]
The SLIC table read on pure hardware and in a virtual machine in fedora 34 and fedora 35.

Description of problem:

The QEMU emulator incorrectly interprets the contents of the SLIC table.
See attached image.

Version-Release number of selected component (if applicable):

Fedora 34 has:
    kernel-5.14.15-200.fc34.x86_64
    qemu-system-x86-5.2.0-8.fc34.x86_64

Fedora 35 has:
    kernel-5.14.15-300.fc35.x86_64
    qemu-system-x86-6.1.0-9.fc35.x86_64

How reproducible:

Steps to Reproduce:

1. Install Fedora 34

2. Install virtualization group:
 
      dnf group install virtualization

4. Place SLIC binary image(slic.bin) into the direcrory /var/lib/libvirt/images

3. Create Virtual Machine with Virtual Machine Manager.

4. Modify xml description of virtual machine:
   ...
   <os>
      ...
      <acpi>
         <table type='slic'>/var/lib/libvirt/images/slic.bin</table>
      </acpi>
   </os>
   ...

5. Install Microsoft Windows 7 64-bit into Virtual machine.

6. Place sertificate into Windows 7.

7. Run with admin rights:

       slmgr.vbs /ilc <sertificate>
       slmgr.vbs /ipk <key>

8. Windows 7 will be activated !

9. Save Virtual Machine Image and it's xml description anywere.

10. Install Fedora 35

11. Install virtualization group.

12. Place saved Virtual Machine Image and slic.bin into the directory /var/lib/libvirt/images/

13. Register virtual machine:

        virsh -c qemu:///system define <xml_file>

15. Run virtual machine - Windows 7 will lose it activation.

Comment 1 Richard W.M. Jones 2021-11-04 10:37:41 UTC
I think this bug is better reported upstream.  Since there's a difference
between the two versions you might try:

 - Does it reproduce with upstream qemu

 - If yes, bisect between qemu 5.2 and 6.1 to see what change introduce the problem

Comment 2 Dmitry V. Orekhov 2021-11-04 10:47:37 UTC
Created attachment 1839839 [details]
SLIC binary image

Comment 3 Dmitry V. Orekhov 2021-11-04 10:50:04 UTC
Created attachment 1839840 [details]
Sertificate for Windows 7 activation

Comment 4 Dmitry V. Orekhov 2021-11-04 10:50:44 UTC
Created attachment 1839841 [details]
Key for Windows 7 activation

Comment 5 Dmitry V. Orekhov 2021-11-04 10:51:35 UTC
Created attachment 1839842 [details]
Executable for reading SLIC under Windows 7

Comment 6 Dmitry V. Orekhov 2021-11-04 11:52:18 UTC
I have created a problem report: https://gitlab.com/qemu-project/qemu/-/issues/707

Comment 7 Dmitry V. Orekhov 2022-01-13 09:34:42 UTC
A solution to the problem may have been found.

I can't apply the patch to the qemu-6.1.0 source code on my own.

Comment 8 Dmitry V. Orekhov 2022-01-13 13:09:13 UTC
Created attachment 1850582 [details]
Working patch

The problem has been solved.

Please distribute it with updates for Fedora 35.

Comment 9 Cole Robinson 2022-01-14 15:44:51 UTC
Dmitry, when the patch is applied upstream, please reference the commit here and I'll backport it to fedora

Comment 11 Dmitry V. Orekhov 2022-05-10 14:44:30 UTC
3 months have passed. Fedora 36 has been released, but the source code of the QEMU package (qemu-6.2.0-9.fc36.src.rpm) does not contain the developed patch.

Is it difficult to apply the patch created by the developers of the QEMU package ?

The current version of Fedora OS (Fedora 36) continues to contain the error described here !

Comment 12 Richard W.M. Jones 2022-05-12 19:46:02 UTC
This is run by volunteers, and qemu builds take a long time (many hours) and
if they go wrong someone has to babysit them.  You can become a volunteer yourself
if you want and then you'll be able to add the patch:

https://docs.fedoraproject.org/en-US/project/join/

Anyway I will add the patch soon.

Comment 13 Richard W.M. Jones 2022-05-13 10:06:41 UTC
Putting back to NEW state.

Cherry picking only 748c030f360a940fe0c9382c8ca1649096c3a80d as outlined
above appears like it may be causing test hangs.  We believe these could
be related to this patch because "bios-tables-test" does not run in the
modified code.

Looking at the patch, it seems some of the earlier patches are also required,
but I don't know which ones.

Comment 14 Richard W.M. Jones 2022-05-13 10:29:35 UTC
I have confirmed with a local mock build that just cherry-picking the
single patch causes bios-tables-test to silently hang.

Comment 15 Dmitry V. Orekhov 2022-05-13 10:50:16 UTC
I do not know how the tests are written, but the test is also a program that can be incorrectly written.

If you do the following:
    1. Make the changes that are specified in the patch ( https://gitlab.com/qemu-project/qemu/-/commit/748c030f360a940fe0c9382c8ca1649096c3a80d )

    2. Build QEMU from sources with the command:

        rpm-build -bb --without=check qemu.spec

    3. Reinstall QEMU from *.rpm packages with the command:

        rpm --reinstall <all-installed-qemu-rpm's>

Then the slic file will be interpreted correctly and Windows 7 will not lose activation.

All changes were made to the current source codes (qemu-6.2.0-9.fc36.src.rpm), without the use of any other patches.

It really works !!!

Comment 16 Igor Mammedov 2022-05-13 10:58:06 UTC
One needs to backport whole set if tests are run:

408ca92634 tests: acpi: test short OEM_ID/OEM_TABLE_ID values in test_oem_fields()
5adc3aba87 tests: acpi: update expected blobs
748c030f36 acpi: fix OEM ID/OEM Table ID padding
d1e4a46541 tests: acpi: whitelist nvdimm's SSDT and FACP.slic expected blobs
a849522f72 tests: acpi: manually pad OEM_ID/OEM_TABLE_ID for test_oem_fields() test

if 'tests: acpi: update expected blobs' doesn't apply to your source tree,
one needs to follow procedure to regenerate blobs as described at the beginning
of tests/qtest/bios-tables-test.c

Comment 17 Fedora Update System 2022-05-18 10:57:37 UTC
FEDORA-2022-6ae3d4f991 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-6ae3d4f991

Comment 18 Fedora Update System 2022-05-19 15:37:23 UTC
FEDORA-2022-6ae3d4f991 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-6ae3d4f991`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-6ae3d4f991

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 19 Fedora Update System 2022-05-23 01:14:24 UTC
FEDORA-2022-6ae3d4f991 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.