- Update to upstream version 3.1:

* Support for SMBIOS 3.1.0 and 3.1.1. This includes new chassis
    types, new processor family names, new processor family upgrade
    names, and new slot types, as well as support of larger BIOS
    ROM sizes and cache sizes, and a new structure type (43, TPM
    Device.)
  * A new command line option to query OEM strings.
  * All error messages are now printed on stderr (#47274, #48158.)
  * Fixes a crash with SIGBUS (#46066.)
  * Various minor fixes, improvements and cleanups.
  * Obsoletes dmidecode-01-add-no-sysfs-option-description-to-h-output.patch,
    dmidecode-02-fix-no-smbios-nor-dmi-entry-point-found-on-smbios3.patch,
    dmidecode-03-let-read_file-return-the-actual-data-size.patch,
    dmidecode-04-use-read_file-to-read-the-dmi-table-from-sysfs.patch,
    dmidecode-05-use-dword-for-structure-table-maximum-size-in-smbios3.patch,
    dmidecode-06-hide-irrelevant-fixup-message.patch, and
    dmidecode-07-only-decode-one-dmi-table.patch.

OBS-URL: https://build.opensuse.org/package/show/Base:System/dmidecode?expand=0&rev=38
This commit is contained in:
Jean Delvare 2017-05-24 13:58:17 +00:00 committed by Git OBS Bridge
parent 9c372773ea
commit 4aebc28fb8
13 changed files with 26 additions and 388 deletions

View File

@ -1,22 +0,0 @@
From: Roy Franz <roy.franz@linaro.org>
Date: Thu, 1 Oct 2015 08:41:43 +0200
Subject: Add "--no-sysfs" option description to -h output
Git-commit: 33b5aafc6ee6b5de9f2526fb1cf4b14d1e16e4f0
A description of --no-sysfs was not added to the output of "-h" when
the feature was added, so add it now.
---
dmiopt.c | 1 +
1 file changed, 1 insertion(+)
--- dmidecode-3.0.orig/dmiopt.c 2016-05-03 16:05:03.135840902 +0200
+++ dmidecode-3.0/dmiopt.c 2016-05-03 16:05:04.199850803 +0200
@@ -314,6 +314,7 @@ void print_help(void)
" -u, --dump Do not decode the entries\n"
" --dump-bin FILE Dump the DMI data to a binary file\n"
" --from-dump FILE Read the DMI data from a binary file\n"
+ " --no-sysfs Do not attempt to read DMI data from sysfs files\n"
" -V, --version Display the version and exit\n";
printf("%s", help);

View File

@ -1,44 +0,0 @@
From: Xie XiuQi <xiexiuqi@huawei.com>
Date: Wed, 21 Oct 2015 15:12:50 +0200
Subject: Fix 'No SMBIOS nor DMI entry point found' on SMBIOS3
Git-commit: bf7bad24ce141dab5b5acc3ffb98ce5fe4a8e0f9
address_from_efi may return a SMBIOS or SMBIOS3 format entry
point, so add this condition.
---
AUTHORS | 1 +
dmidecode.c | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
--- dmidecode-3.0.orig/AUTHORS 2016-05-03 16:05:03.118840743 +0200
+++ dmidecode-3.0/AUTHORS 2016-05-03 16:05:07.803884342 +0200
@@ -19,6 +19,7 @@ Jarod Wilson <jarod@redhat.com>
Anton Arapov <anton@redhat.com>
Roy Franz <roy.franz@linaro.org>
Tyler Bell <tyler.bell@hp.com>
+Xie XiuQi <xiexiuqi@huawei.com>
MANY THANKS TO (IN CHRONOLOGICAL ORDER)
Werner Heuser
--- dmidecode-3.0.orig/dmidecode.c 2016-05-03 16:05:03.118840743 +0200
+++ dmidecode-3.0/dmidecode.c 2016-05-03 16:05:07.804884352 +0200
@@ -4864,8 +4864,16 @@ int main(int argc, char * const argv[])
goto exit_free;
}
- if (smbios_decode(buf, opt.devmem, 0))
- found++;
+ if (memcmp(buf, "_SM3_", 5) == 0)
+ {
+ if (smbios3_decode(buf, opt.devmem, 0))
+ found++;
+ }
+ else if (memcmp(buf, "_SM_", 4) == 0)
+ {
+ if (smbios_decode(buf, opt.devmem, 0))
+ found++;
+ }
goto done;
memory_scan:

View File

@ -1,90 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 2 Nov 2015 09:45:26 +0100
Subject: Let read_file return the actual data size
Git-commit: de9a74e1c60210bee229fcf55b1678a99d1b44dd
Let read_file return the actual data size to the caller. This gives
the caller the possibility to check that the data size is as expected
and large enough for the purpose, and report to the user if not.
---
dmidecode.c | 4 +++-
util.c | 11 +++++++----
util.h | 2 +-
3 files changed, 11 insertions(+), 6 deletions(-)
--- dmidecode-3.0.orig/dmidecode.c 2016-05-03 16:05:07.804884352 +0200
+++ dmidecode-3.0/dmidecode.c 2016-05-03 16:05:09.139896776 +0200
@@ -4748,6 +4748,7 @@ int main(int argc, char * const argv[])
int ret = 0; /* Returned value */
int found = 0;
off_t fp;
+ size_t size;
int efi;
u8 *buf;
@@ -4817,8 +4818,9 @@ int main(int argc, char * const argv[])
* contain one of several types of entry points, so read enough for
* the largest one, then determine what type it contains.
*/
+ size = 0x20;
if (!(opt.flags & FLAG_NO_SYSFS)
- && (buf = read_file(0x20, SYS_ENTRY_FILE)) != NULL)
+ && (buf = read_file(&size, SYS_ENTRY_FILE)) != NULL)
{
if (!(opt.flags & FLAG_QUIET))
printf("Getting SMBIOS data from sysfs.\n");
--- dmidecode-3.0.orig/util.c 2016-05-03 16:05:03.085840436 +0200
+++ dmidecode-3.0/util.c 2016-05-03 16:05:09.139896776 +0200
@@ -94,10 +94,11 @@ int checksum(const u8 *buf, size_t len)
* needs to be freed by the caller.
* This provides a similar usage model to mem_chunk()
*
- * Returns pointer to buffer of max_len bytes, or NULL on error
+ * Returns pointer to buffer of max_len bytes, or NULL on error, and
+ * sets max_len to the length actually read.
*
*/
-void *read_file(size_t max_len, const char *filename)
+void *read_file(size_t *max_len, const char *filename)
{
int fd;
size_t r2 = 0;
@@ -115,7 +116,7 @@ void *read_file(size_t max_len, const ch
return(NULL);
}
- if ((p = malloc(max_len)) == NULL)
+ if ((p = malloc(*max_len)) == NULL)
{
perror("malloc");
return NULL;
@@ -123,7 +124,7 @@ void *read_file(size_t max_len, const ch
do
{
- r = read(fd, p + r2, max_len - r2);
+ r = read(fd, p + r2, *max_len - r2);
if (r == -1)
{
if (errno != EINTR)
@@ -140,6 +141,8 @@ void *read_file(size_t max_len, const ch
while (r != 0);
close(fd);
+ *max_len = r2;
+
return p;
}
--- dmidecode-3.0.orig/util.h 2016-05-03 16:05:03.085840436 +0200
+++ dmidecode-3.0/util.h 2016-05-03 16:05:09.139896776 +0200
@@ -25,7 +25,7 @@
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
int checksum(const u8 *buf, size_t len);
-void *read_file(size_t len, const char *filename);
+void *read_file(size_t *len, const char *filename);
void *mem_chunk(off_t base, size_t len, const char *devmem);
int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add);
u64 u64_range(u64 start, u64 end);

View File

@ -1,67 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 2 Nov 2015 09:45:31 +0100
Subject: dmidecode: Use read_file() to read the DMI table from sysfs
Git-commit: 364055211b1956539c6a6268e111e244e1292c8c
References: https://savannah.nongnu.org/bugs/?46176
We shouldn't use mem_chunk() to read the DMI table from sysfs. This
will fail for SMBIOS v3 implementations which specify a maximum length
for the table rather than its exact length. The kernel will trim the
table to the actual length, so the DMI file will be shorter than the
length announced in entry point.
read_file() fits the bill in this case, as it deals with end of file
nicely.
This also helps with corrupted DMI tables, as the kernel will not
export the part of the table that it wasn't able to parse, effectively
trimming it.
This fixes bug #46176:
https://savannah.nongnu.org/bugs/?46176
Unexpected end of file error
---
dmidecode.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
--- dmidecode-3.0.orig/dmidecode.c 2016-05-03 16:05:09.139896776 +0200
+++ dmidecode-3.0/dmidecode.c 2016-05-03 16:05:10.336907916 +0200
@@ -4521,16 +4521,29 @@ static void dmi_table(off_t base, u32 le
printf("\n");
}
- /*
- * When we are reading the DMI table from sysfs, we want to print
- * the address of the table (done above), but the offset of the
- * data in the file is 0. When reading from /dev/mem, the offset
- * in the file is the address.
- */
if (flags & FLAG_NO_FILE_OFFSET)
- base = 0;
+ {
+ /*
+ * When reading from sysfs, the file may be shorter than
+ * announced. For SMBIOS v3 this is expcted, as we only know
+ * the maximum table size, not the actual table size. For older
+ * implementations (and for SMBIOS v3 too), this would be the
+ * result of the kernel truncating the table on parse error.
+ */
+ size_t size = len;
+ buf = read_file(&size, devmem);
+ if (!(opt.flags & FLAG_QUIET) && num && size != (size_t)len)
+ {
+ printf("Wrong DMI structures length: %u bytes "
+ "announced, only %lu bytes available.\n",
+ len, (unsigned long)size);
+ }
+ len = size;
+ }
+ else
+ buf = mem_chunk(base, len, devmem);
- if ((buf = mem_chunk(base, len, devmem)) == NULL)
+ if (buf == NULL)
{
fprintf(stderr, "Table is unreachable, sorry."
#ifndef USE_MMAP

View File

@ -1,29 +0,0 @@
From: Xie XiuQi <xiexiuqi@huawei.com>
Date: Mon, 1 Feb 2016 09:30:31 +0100
Subject: Use DWORD for Structure table maximum size in SMBIOS3
Git-commit: ab02b117511230e46bbef7febbd854b9c832c13c
0Ch DWORD "Structure table maximum size"
Maximum size of SMBIOS Structure Table, pointed to by
the Structure Table Address, in bytes. The actual size is
guaranteed to be less or equal to the maximum size.
Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- dmidecode-3.0.orig/dmidecode.c 2016-05-03 16:05:10.336907916 +0200
+++ dmidecode-3.0/dmidecode.c 2016-05-03 16:05:11.533919057 +0200
@@ -4612,7 +4612,7 @@ static int smbios3_decode(u8 *buf, const
}
dmi_table(((off_t)offset.h << 32) | offset.l,
- WORD(buf + 0x0C), 0, ver, devmem, flags | FLAG_STOP_AT_EOT);
+ DWORD(buf + 0x0C), 0, ver, devmem, flags | FLAG_STOP_AT_EOT);
if (opt.flags & FLAG_DUMP_BIN)
{

View File

@ -1,49 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 3 May 2016 15:32:21 +0200
Subject: dmidecode: Hide irrelevant fixup message
Git-commit: cff11afa886a0147d734b650755d232b5e7f2099
References: http://savannah.nongnu.org/support/?109024
Only display the message about type 34 length fixup if the entry in
question is going to be displayed. Otherwise it's only confusing.
This fixes bug #109024:
http://savannah.nongnu.org/support/?109024
Fixes: 3f70b3515d91 ("dmidecode: Fix up invalid DMI type 34 structure length")
---
dmidecode.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- dmidecode-3.0.orig/dmidecode.c 2016-05-03 16:05:11.533919057 +0200
+++ dmidecode-3.0/dmidecode.c 2016-05-03 16:05:13.223934786 +0200
@@ -2946,7 +2946,7 @@ static void dmi_64bit_memory_error_addre
* first 5 characters of the device name to be trimmed. It's easy to
* check and fix, so do it, but warn.
*/
-static void dmi_fixup_type_34(struct dmi_header *h)
+static void dmi_fixup_type_34(struct dmi_header *h, int display)
{
u8 *p = h->data;
@@ -2954,7 +2954,9 @@ static void dmi_fixup_type_34(struct dmi
if (h->length == 0x10
&& is_printable(p + 0x0B, 0x10 - 0x0B))
{
- printf("Invalid entry length (%u). Fixed up to %u.\n", 0x10, 0x0B);
+ if (!(opt.flags & FLAG_QUIET) && display)
+ printf("Invalid entry length (%u). Fixed up to %u.\n",
+ 0x10, 0x0B);
h->length = 0x0B;
}
}
@@ -4443,7 +4445,7 @@ static void dmi_table_decode(u8 *buf, u3
/* Fixup a common mistake */
if (h.type == 34)
- dmi_fixup_type_34(&h);
+ dmi_fixup_type_34(&h, display);
/* look for the next handle */
next = data + h.length;

View File

@ -1,68 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 20 Jan 2017 10:57:12 +0100
Subject: Only decode one DMI table
Git-commit: 12fbde92a26da61eda9f2ff0ba3c316779163f10
References: https://savannah.nongnu.org/bugs/?50022
Since version 3.0.0 of the SMBIOS specification, there can be
multiple entry points in memory, pointing to one or two DMI tables.
If both a 32-bit ("_SM_") entry point and a 64-bit ("_SM3_") entry
point are present, the specification requires that the latter points
to a table which is a super-set of the table pointed to by the
former. Therefore it makes no sense to decode both.
Per specification, look for a 64-bit ("_SM3_") entry point first, and
if we can't find any, look for a 32-bit ("_SM_" or "_DMI_") entry
point.
This fixes bug #50022:
https://savannah.nongnu.org/bugs/?50022
---
dmidecode.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4903,28 +4903,37 @@ memory_scan:
goto exit_free;
}
- for (fp = 0; fp <= 0xFFF0; fp += 16)
+ /* Look for a 64-bit entry point first */
+ for (fp = 0; fp <= 0xFFE0; fp += 16)
{
- if (memcmp(buf + fp, "_SM3_", 5) == 0 && fp <= 0xFFE0)
+ if (memcmp(buf + fp, "_SM3_", 5) == 0)
{
if (smbios3_decode(buf + fp, opt.devmem, 0))
{
found++;
- fp += 16;
+ goto done;
}
}
- else if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0)
+ }
+
+ /* If none found, look for a 32-bit entry point */
+ for (fp = 0; fp <= 0xFFF0; fp += 16)
+ {
+ if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0)
{
if (smbios_decode(buf + fp, opt.devmem, 0))
{
found++;
- fp += 16;
+ goto done;
}
}
else if (memcmp(buf + fp, "_DMI_", 5) == 0)
{
if (legacy_decode(buf + fp, opt.devmem, 0))
+ {
found++;
+ goto done;
+ }
}
}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7ec35bb193729c1d593a1460b59d82d24b89102ab23fd0416e6cf4325d077e45
size 58704

Binary file not shown.

3
dmidecode-3.1.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d766ce9b25548c59b1e7e930505b4cad9a7bb0b904a1a391fbb604d529781ac0
size 61204

BIN
dmidecode-3.1.tar.xz.sig Normal file

Binary file not shown.

View File

@ -1,3 +1,24 @@
-------------------------------------------------------------------
Wed May 24 13:50:05 UTC 2017 - jdelvare@suse.de
- Update to upstream version 3.1:
* Support for SMBIOS 3.1.0 and 3.1.1. This includes new chassis
types, new processor family names, new processor family upgrade
names, and new slot types, as well as support of larger BIOS
ROM sizes and cache sizes, and a new structure type (43, TPM
Device.)
* A new command line option to query OEM strings.
* All error messages are now printed on stderr (#47274, #48158.)
* Fixes a crash with SIGBUS (#46066.)
* Various minor fixes, improvements and cleanups.
* Obsoletes dmidecode-01-add-no-sysfs-option-description-to-h-output.patch,
dmidecode-02-fix-no-smbios-nor-dmi-entry-point-found-on-smbios3.patch,
dmidecode-03-let-read_file-return-the-actual-data-size.patch,
dmidecode-04-use-read_file-to-read-the-dmi-table-from-sysfs.patch,
dmidecode-05-use-dword-for-structure-table-maximum-size-in-smbios3.patch,
dmidecode-06-hide-irrelevant-fixup-message.patch, and
dmidecode-07-only-decode-one-dmi-table.patch.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jan 20 13:18:38 CET 2017 - jdelvare@suse.de Fri Jan 20 13:18:38 CET 2017 - jdelvare@suse.de

View File

@ -1,7 +1,7 @@
# #
# spec file for package dmidecode # spec file for package dmidecode
# #
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -17,7 +17,7 @@
Name: dmidecode Name: dmidecode
Version: 3.0 Version: 3.1
Release: 0 Release: 0
Summary: DMI table decoder Summary: DMI table decoder
License: GPL-2.0+ License: GPL-2.0+
@ -28,13 +28,6 @@ Source1: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{vers
# would be, but tarball is signed by someone else without signatures. # would be, but tarball is signed by someone else without signatures.
# https://savannah.nongnu.org/project/memberlist-gpgkeys.php?group=dmidecode # https://savannah.nongnu.org/project/memberlist-gpgkeys.php?group=dmidecode
# Source2: %{name}.keyring # Source2: %{name}.keyring
Patch1: dmidecode-01-add-no-sysfs-option-description-to-h-output.patch
Patch2: dmidecode-02-fix-no-smbios-nor-dmi-entry-point-found-on-smbios3.patch
Patch3: dmidecode-03-let-read_file-return-the-actual-data-size.patch
Patch4: dmidecode-04-use-read_file-to-read-the-dmi-table-from-sysfs.patch
Patch5: dmidecode-05-use-dword-for-structure-table-maximum-size-in-smbios3.patch
Patch6: dmidecode-06-hide-irrelevant-fixup-message.patch
Patch7: dmidecode-07-only-decode-one-dmi-table.patch
Provides: pmtools:%{_sbindir}/dmidecode Provides: pmtools:%{_sbindir}/dmidecode
Obsoletes: pmtools < 20071117 Obsoletes: pmtools < 20071117
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -57,13 +50,6 @@ the BIOS told it to.
%prep %prep
%setup -q %setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%build %build
make CFLAGS="%{optflags}" %{?_smp_mflags} make CFLAGS="%{optflags}" %{?_smp_mflags}