| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Functions smbios_decode() and smbios3_decode() include a check
against buffer overrun. This check assumes that the buffer length is
always 32 bytes. This is true when reading from /dev/mem or from a
dump file, however when reading from sysfs, the buffer length is the
size of the actual sysfs attribute file, typically 31 bytes for an
SMBIOS 2.x entry point and 24 bytes for an SMBIOS 3.x entry point.
In the unlikely event of a malformed entry point, with encoded length
larger than expected but smaller than or equal to 32, we would hit a
buffer overrun. So properly pass the actual buffer length as an
argument and perform the check against it.
In practice, this will never happen, because on the Linux kernel
side, the size of the sysfs attribute file is decided from the entry
point length field. So it is technically impossible for them not to
match. But user-space code should not make such assumptions.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use read_file() instead of mem_chunk() to read the entry point from a
dump file. This is faster, and consistent with how we then read the
actual DMI table from that dump file.
This made no functional difference so far, which is why it went
unnoticed for years. But now that a file type check was added to the
mem_chunk() function, we must stop using it to read from regular
files.
This will again allow root to use the --from-dump option.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Jerry Hoemann <jerry.hoemann@hpe.com>
|
|
|
|
|
|
|
|
|
|
|
| |
It turns out that variables "offset" and "key" have the same value
for these lines of code, so there is no actual bug, nevertheless
using the right variable makes the code more obviously correct, and
less prone to introduce a bug later when adding support for new
strings.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Jerry Hoemann <jerry.hoemann@hpe.com>
|
|
|
|
|
|
|
|
|
|
| |
Make sure that the file passed to option --dump-bin does not already
exist. In practice, it is rather unlikely that an honest user would
want to overwrite an existing dump file, while this possibility
could be used by a rogue user to corrupt a system file.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jerry Hoemann <jerry.hoemann@hpe.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When option --dump-bin is used, write the whole dump file at once,
instead of opening and closing the file separately for the table
and then for the entry point.
As the file writing function is no longer generic, it gets moved
from util.c to dmidecode.c.
One minor functional change resulting from the new implementation is
that the entry point is written first now, so the messages printed
are swapped.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jerry Hoemann <jerry.hoemann@hpe.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clean up function dmi_table so that it does only one thing:
* dmi_table() is renamed to dmi_table_get(). It now retrieves the
DMI table, but does not process it any longer.
* Decoding or dumping the table is now done in smbios3_decode(),
smbios_decode() and legacy_decode().
No functional change.
A side effect of this change is that writing the header and body of
dump files is now done in a single location. This is required to
further consolidate the writing of dump files.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jerry Hoemann <jerry.hoemann@hpe.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Back in 2003, I had a system where the CPU type was not set. I added
a quirk so that it would still be recognized as x86, and the CPUID
could be decoded.
A few more exceptions where added over the years, but in effect, the
list was last modified in 2008.
Having such an exception list isn't actually a good idea, for the
following reasons:
* It requires endless maintenance work if we want to keep it
up-to-date.
* It adds some (admittedly minimal) burden to the sane systems.
* If we were to add more entries to the exception list, it wouldn't
scale well (linear algorithmic complexity). This could be improved
but at the cost of more complex code.
* It sends the wrong message to the hardware manufacturers ("You can
get things wrong, we'll add a workaround on our side.")
Therefore I would like to get rid of this exception list. Doing so
has the nice side effect of simplifying the code and making the
binary smaller.
If anyone really needs the CPUID information on such non-compliant
systems, there are other ways to retrieve it, such as lscpu or
/proc/cpuinfo.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
| |
This new option is aimed at firmware developers to help them validate
their work. When this option is used, quirks and fixups are disabled
in dmidecode, which will dumbly decode everything found in the table
even if it is known to be incorrect.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
|
| |
Ensure that the SMBIOS entry point is long enough to include all the
fields we need. Otherwise it is pointless to even attempt to verify
its checksum.
A similar check was added to the SMBIOS entry point parser in the
Linux kernel.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
| |
While we do not support every piece of the specification yet, the
most needed ones are in place now so it seems reasonable to stop
warning users.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
| |
Types 126 and 127 are at the end of the list, their reference section
changes as new structure types are being added to the specification.
Just omit the section number for them, so that we don't have to
update it with every new version of the specification.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
| |
Add types 44, 45 and 46 to dmi_smbios_structure_type().
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
| |
SMBIOS specification 3.5.0 adds a new record type: Firmware Inventory
Information. Add support for it.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
| |
Version 3.5.0 of the SMBIOS specification added the following:
* BIOS Information: Manufacturing mode flags
* System Slots: Slot height field
* Built-in Pointing Device: 2 new interface types
* Onboard Devices Extended Information: 7 new device types
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
| |
When adding support for SMBIOS 3.4.0, we missed new enumerated
values for the slot type field, and 3 new fields at the end of
System Slots (type 9) structures.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
| |
Let dmi_slot_bus_width() return its value without a trailing space,
so that this function can be reused in a different context.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
| |
In order to decode the information from HPE type 199 in a
human-friendly way, we need to know how the CPUID data is encoded.
This depends on the CPU brand and family, so save this information for
later.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
| |
Let the caller choose which printing helper function will be used.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
| |
Split the printing of the CPUID into a human-friendly way to a
separate function. That way, it can be reused for other record types
as needed.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
| |
Move the code which decides the CPUID type to a separate function, so
that it can be called from a different context.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
| |
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
| |
It has little value on supported systems as we decode the same
information in a more human-friendly way immediately after.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
|
| |
Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz has byte value 3Fh which
means Socket LGA4677 for Processor Information - Processor Upgrade
field.
[JD: Fix upper array boundary check.]
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
|
|
| |
For ARM64-class CPUs, the format of the Processor ID field depends on
the processor's support of the SMCCC_ARCH_SOC_ID architectural call.
This supports decoding the Processor ID correctly in case the SoC ID is
supported. This patch should work for ARM32-class CPUs also.
[JD: Simplify boolean test.]
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
| |
A segmentation fault was reported with option -u. Turns out to be a
stupid thinko where the buffer offset was reset at the wrong loop
depth.
Reported-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Fixes: da06888d08b9 ("dmidecode: Use the print helpers in dump mode too")
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
| |
Make dmi_print_memory_size() global so that it can be called from
outside of dmidecode.c.
Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
| |
Use the appropriate format specifiers to make the compiler happy.
This fixes support ticket #110421:
https://savannah.nongnu.org/support/index.php?110421
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
| |
If OEM type entries come before the type 1 entry (System
Information), we aren't able to decode them because we don't know
the vendor yet. To fix this, figure out the vendor during a first
pass, and walk the table again once we have the information.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reported-by: Erwan Velu <e.velu@criteo.com>
|
|
|
|
|
|
|
|
| |
The normal printable ASCII range is 32 to 127 (not included),
so fix the error in this if condition.
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
| |
The strings passed to dmi_set_vendor will never be printed,
they are used for comparison purposes only, so the pre- and
post-processing done by dmi_string is not needed. Call
_dmi_string instead, which is faster.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the initialization of "type", a suspicious concatenated string
"PCI Express Mini 76-pinPCI Express 4 SFF-8639 (U.2)" is produced
due to a missing comma between lines.
[JD: Fixed a similar bug in dmi_processor_characteristics.]
Fixes: b289de9deb32 ("Add new processor characteristics bits from SMBIOS spec 3.4.0")
Fixes: c54348130a2a ("dmidecode: Add new system slot types from SMBIOS spec 3.4.0")
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
| |
Decoding of OEM records can depend upon the product in addition
to the manufacturer. So, save "Product Name" from type 1 record
in addition to "Manufacturer" in dmi_set_vendor.
Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
|
| |
If a memory slot is empty then by definition the fields containing
the memory module details are irrelevant. Best case they are filled
with "Unused" and "None", but in some cases they are even invalid
because the manufacturer did not bother setting the fields to
valid neutral values. So it is better to not print these fields
at all, so as to not confuse the user.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
| |
* The bit to indicate 128-bit capable processor
* The bit to indicate processor supports returning ARM64 SoC ID
|
|
|
|
|
|
|
|
|
| |
Based on an earlier patch from Prabhakar Pujeri (Dell).
Version 3.4.0 of the SMBIOS specification adds 14 new system slot
types and updates 2 (DMI type 9).
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
| |
These fields were added by SMBIOS version 3.3.0. and although there
is no hardware fast enough to need them yet, we can support them
already. I missed them before because their addition is not mentioned
in the specification change log.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
| |
* The bit to indicate PCIe surprise removal support.
* The bit to indicate Flexbus CXL 1.0 version.
* The bit to indicate Flexbus CXL 2.0 version.
|
|
|
|
| |
Added 2 more new values (0x3D and 0x3E).
|
|
|
|
| |
Added 2 more new values (0x22 and 0x23).
|
| |
|
|
|
|
|
|
|
|
| |
Even though we do not fully support SMBIOS version 3.3.0 yet, the
missing parts are not even in the works, and I have yet to see an actual
system needing them. So stop warning the users.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
| |
This reverts commit 85a05114311a78c493eeb6c9b664b22c0d1c2e35.
This change was not properly reviewed before being committed and
introduces a regression, in addition to having coding style issues.
|
|
|
|
|
|
|
| |
This reverts commit 92853b621ff72e3ba87e0ed7675d2103d05b8d3c.
This is not a bug in dmidecode. It is the BIOS' responsibility to encode
the memory technology to 0x02 for "Unknown" when a slot is not in use.
|
|
|
|
| |
According to SMBIOS spec 3.4.0 Table 75 – Memory Device (Type 17) structure if the size of the memory device is 0 then we should consider the slot is empty
|
|
|
|
| |
In SMBIOS SPEC 3.4.0 section 7.10.1 System Slots — Slot Type some of fields are missing in current dmidecode source.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Add a helper function to print structure errors, specifically for
structures which do not fit in the table.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
| |
A simple helper function to print a blank line between records.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
| |
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|