Open gabonator opened 1 year ago
While investigating some corruption, I noticed something similar, and made a fix: https://gerrit.openbmc.org/c/openbmc/smbios-mdr/+/69322
I also made https://gerrit.openbmc.org/c/openbmc/smbios-mdr/+/69457 for adding SMBIOS version 3.4 support. I would add 3.1 at the same time, but I have no 3.1 machine to test on.
I have following scenario: I prepend smbios snapshot with proper
MDRSMBIOSHeader
structure at the beginning of/var/lib/smbios/smbios2
with following script on bmc/container side:My first problem was that
smbios-mdr
requires smbios tables of version 3.2 or higher, whereas my snapshot is just 3.1. I was able to add support for this version, but noticed thatMDRV2
constructor does not clear thesmbiosTableStorage
buffer which is used to hold the smbios data from/var/lib/smbios2
andMDRV2::checkSMBIOSVersion
scans whole buffer:https://github.com/openbmc/smbios-mdr/blob/e05a542324fcac40c9ff100287302ee92ed03621/src/mdrv2.cpp#L657-L665
Either the real smbios table buffer size should be used in
std::string buffer(dataIn, dataIn + smbiosTableStorageSize)
or the buffer should be cleared in MDRV2 constructor:Even after this change the
checkSMBIOSVersion
is not safe in cases where the_SM_
token is part of the strings section or is present somewhere in the dump.Anyway, if anyone is struggling with smbios 3.1 support, here is a patch to enable it - it is just a workaround which skips the header, it works only for
dmidecode
dumps whereStructure table address
(qword attribute @+0x10) holds the size of the header: