RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2023977 - Duplicate SMBIOS handles when creating large VMs
Summary: Duplicate SMBIOS handles when creating large VMs
Keywords:
Status: CLOSED ERRATA
Alias: None
Deadline: 2022-05-23
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: qemu-kvm
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: rc
: 9.1
Assignee: Ani Sinha
QA Contact: Yiqian Wei
URL:
Whiteboard:
Depends On: 2064757
Blocks: 1788991
TreeView+ depends on / blocked
 
Reported: 2021-11-16 21:48 UTC by Eduardo Habkost
Modified: 2022-11-15 10:15 UTC (History)
12 users (show)

Fixed In Version: qemu-kvm-7.0.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 09:53:29 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-102990 0 None None None 2021-11-16 21:52:41 UTC
Red Hat Product Errata RHSA-2022:7967 0 None None None 2022-11-15 09:54:15 UTC

Description Eduardo Habkost 2021-11-16 21:48:46 UTC
When creating VMs with a large amount of RAM, the SMBIOS tables created by QEMU may contain duplicate handle IDs.

Problem diagnosed at:
https://bugzilla.redhat.com/show_bug.cgi?id=1904267#c51

Copying from original report:

(In reply to Eduardo Habkost)
> (In reply to Brian Payton)
> > ASSERT_EFI_ERROR (Status = Already started)
> > ASSERT
> > /builddir/build/BUILD/edk2-ca407c7246bf/OvmfPkg/SmbiosPlatformDxe/
> > SmbiosPlatformDxe.c(125): !EFI_ERROR (Status)
> 
> This one might be an unexpected duplicate SMBIOS handle in the tables
> generated by QEMU.  I will double-check the SMBIOS table generation code to
> be sure.

Yes, this is where the problem comes from:


static void smbios_build_type_17_table(unsigned instance, uint64_t size)
{
    SMBIOS_BUILD_TABLE_PRE(17, 0x1100 + instance, true); /* required */

...
static void smbios_build_type_19_table(unsigned instance,
                                       uint64_t start, uint64_t size)
{
    SMBIOS_BUILD_TABLE_PRE(19, 0x1300 + instance, true); /* required */


Using the current handle assignment code, we can have only up to 512 DIMM slots before their type 17 SMBIOS handles conflict with the type 19 table handles.  QEMU has DIMM sizes hardcoded to 16GB, which means an 8TB guest will hit the limit.

Comment 1 John Ferlan 2021-11-23 19:02:15 UTC
Assigning to Amnon for reassignment, NB: module is maintained by mst.

Comment 2 Ani Sinha 2022-02-01 10:37:17 UTC
I am going to take a stab at this. Could not assign the bug to myself unfortunately (I am not redhat :()

Comment 3 Ani Sinha 2022-02-01 11:13:05 UTC
The problem is in this code in smbios_get_tables()

       dimm_cnt = QEMU_ALIGN_UP(current_machine->ram_size, MAX_DIMM_SZ) / MAX_DIMM_SZ;                                                                                         
                                                                                                                                                                                
        smbios_build_type_16_table(dimm_cnt);                                                                                                                                   
                                                                                                                                                                                
        for (i = 0; i < dimm_cnt; i++) {                                                                                                                                        
            smbios_build_type_17_table(i, GET_DIMM_SZ);                                                                                                                         
        }                                                                                                                                                                       
                                                                                                                                                                                
        for (i = 0; i < mem_array_size; i++) {                                                                                                                                  
            smbios_build_type_19_table(i, mem_array[i].address,                                                                                                                 
                                       mem_array[i].length);                                                                                                                    
        }                                                                                                


Clearly after 512 iterations of the first loop, the two tables will collide as 0x1100 + 512 = 0x1300.

Comment 4 Ani Sinha 2022-02-02 04:39:28 UTC
Sent a patch in the mailing list: https://lists.gnu.org/archive/html/qemu-devel/2022-02/msg00358.html

Comment 5 Ani Sinha 2022-02-02 13:40:57 UTC
@ailan@ailan please re-assign this ticket to me.

Comment 6 Amnon Ilan 2022-02-02 16:06:48 UTC
(In reply to Ani Sinha from comment #5)
> @ailan@ailan please re-assign this ticket to me.

Done. Thank you for taking it!

Comment 9 Nitesh Narayan Lal 2022-02-03 13:29:45 UTC
Moving this to rhel9, if the fix is going to come as part of the rebase, then we can mark this as TestOnly.
For rhel8, we will create a clone if required.

Comment 12 Ani Sinha 2022-03-09 10:57:13 UTC
A fix has been pushed upstream: https://git.qemu.org/?p=qemu.git;a=commit;h=a379d4550c4a949bb1ca51bc5272d68b4a619b18 . QE, please verify.

Comment 13 Nitesh Narayan Lal 2022-03-09 16:48:40 UTC
(In reply to Ani Sinha from comment #12)
> A fix has been pushed upstream:
> https://git.qemu.org/?p=qemu.git;a=commit;
> h=a379d4550c4a949bb1ca51bc5272d68b4a619b18 . QE, please verify.

Thanks, Ani, for getting the fix upstream.
I am moving this BZ back to ASSIGNED. Once the patch is merged upstream please add the commit ID in the comment and then move the BZ to POST.

Since the patches will automatically come via reabse there is no action required after that. QE will test it as the images are available.
Igor has already provided a repo with the fix to the reporter, and hopefully, we will hear something soon.

Comment 14 Ani Sinha 2022-03-10 06:29:03 UTC
@nilal the patch has already been merged upstream. That is why I updated the ticket. 

Commit ID: a379d4550c4a949bb1ca51bc5272d68b4a619b18 as I have mentioned above.

Comment 15 Nitesh Narayan Lal 2022-03-10 11:35:02 UTC
(In reply to Ani Sinha from comment #14)
> @nilal the patch has already been merged upstream. That is why I
> updated the ticket. 
> 
> Commit ID: a379d4550c4a949bb1ca51bc5272d68b4a619b18 as I have mentioned
> above.

Got it, thanks for the correction.

Comment 21 errata-xmlrpc 2022-11-15 09:53:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: qemu-kvm security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:7967


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