From 533abc8563761517e3a3557c115f139c36d82407803b6142c2c148c34e134a43 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 26 Aug 2019 12:38:06 +0000 Subject: [PATCH] 2 recommended fixes from upstream: - dmidecode-only-scan-dev-mem-for-entry-point-on-x86.patch: Only scan /dev/mem for entry point on x86 (fixes reboot on ARM64). - dmidecode-fix-formatting-of-tpm-table-output.patch: Fix formatting of TPM table output (missing newlines). OBS-URL: https://build.opensuse.org/package/show/Base:System/dmidecode?expand=0&rev=52 --- ...e-fix-formatting-of-tpm-table-output.patch | 33 ++++++++++ ...-scan-dev-mem-for-entry-point-on-x86.patch | 61 +++++++++++++++++++ dmidecode.changes | 9 +++ dmidecode.spec | 4 ++ 4 files changed, 107 insertions(+) create mode 100644 dmidecode-fix-formatting-of-tpm-table-output.patch create mode 100644 dmidecode-only-scan-dev-mem-for-entry-point-on-x86.patch diff --git a/dmidecode-fix-formatting-of-tpm-table-output.patch b/dmidecode-fix-formatting-of-tpm-table-output.patch new file mode 100644 index 0000000..c2107f5 --- /dev/null +++ b/dmidecode-fix-formatting-of-tpm-table-output.patch @@ -0,0 +1,33 @@ +From 1d0db85949a5bdd96375f6131d393a11204302a6 Mon Sep 17 00:00:00 2001 +From: Deomid rojer Ryabkov +Date: Mon, 26 Aug 2019 14:20:15 +0200 +Subject: [PATCH] Fix formatting of TPM table output + +Added missing newlines. + +Fixes: 48a8132058a0 ("dmidecode: Add support for structure type 43 (TPM Device)") + +--- + dmidecode.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- dmidecode-3.2.orig/dmidecode.c 2019-08-26 14:35:26.209257695 +0200 ++++ dmidecode-3.2/dmidecode.c 2019-08-26 14:35:28.271284010 +0200 +@@ -4991,7 +4991,7 @@ static void dmi_decode(const struct dmi_ + printf("\tVendor ID:"); + dmi_tpm_vendor_id(data + 0x04); + printf("\n"); +- printf("\tSpecification Version: %d.%d", data[0x08], data[0x09]); ++ printf("\tSpecification Version: %d.%d\n", data[0x08], data[0x09]); + switch (data[0x08]) + { + case 0x01: +@@ -5014,7 +5014,7 @@ static void dmi_decode(const struct dmi_ + */ + break; + } +- printf("\tDescription: %s", dmi_string(h, data[0x12])); ++ printf("\tDescription: %s\n", dmi_string(h, data[0x12])); + printf("\tCharacteristics:\n"); + dmi_tpm_characteristics(QWORD(data + 0x13), "\t\t"); + if (h->length < 0x1F) break; diff --git a/dmidecode-only-scan-dev-mem-for-entry-point-on-x86.patch b/dmidecode-only-scan-dev-mem-for-entry-point-on-x86.patch new file mode 100644 index 0000000..2525644 --- /dev/null +++ b/dmidecode-only-scan-dev-mem-for-entry-point-on-x86.patch @@ -0,0 +1,61 @@ +From e12ec26e19e02281d3e7258c3aabb88a5cf5ec1d Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Mon, 26 Aug 2019 14:20:15 +0200 +Subject: [PATCH] dmidecode: Only scan /dev/mem for entry point on x86 + +x86 is the only architecture which can have a DMI entry point scanned +from /dev/mem. Do not attempt it on other architectures, because not +only it can't work, but it can even cause the system to reboot. + +This fixes support request #109697: +https://savannah.nongnu.org/support/?109697 + +--- + dmidecode.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- dmidecode-3.2.orig/dmidecode.c 2019-08-26 14:35:22.767213766 +0200 ++++ dmidecode-3.2/dmidecode.c 2019-08-26 14:35:26.209257695 +0200 +@@ -2,7 +2,7 @@ + * DMI Decode + * + * Copyright (C) 2000-2002 Alan Cox +- * Copyright (C) 2002-2018 Jean Delvare ++ * Copyright (C) 2002-2019 Jean Delvare + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -5535,7 +5535,7 @@ int main(int argc, char * const argv[]) + off_t fp; + size_t size; + int efi; +- u8 *buf; ++ u8 *buf = NULL; + + /* + * We don't want stdout and stderr to be mixed up if both are +@@ -5639,7 +5639,7 @@ int main(int argc, char * const argv[]) + printf("Failed to get SMBIOS data from sysfs.\n"); + } + +- /* Next try EFI (ia64, Intel-based Mac) */ ++ /* Next try EFI (ia64, Intel-based Mac, arm64) */ + efi = address_from_efi(&fp); + switch (efi) + { +@@ -5672,6 +5672,7 @@ int main(int argc, char * const argv[]) + goto done; + + memory_scan: ++#if defined __i386__ || defined __x86_64__ + if (!(opt.flags & FLAG_QUIET)) + printf("Scanning %s for entry point.\n", opt.devmem); + /* Fallback to memory scan (x86, x86_64) */ +@@ -5714,6 +5715,7 @@ int main(int argc, char * const argv[]) + } + } + } ++#endif + + done: + if (!found && !(opt.flags & FLAG_QUIET)) diff --git a/dmidecode.changes b/dmidecode.changes index 96876fc..6793f33 100644 --- a/dmidecode.changes +++ b/dmidecode.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Aug 26 12:35:42 UTC 2019 - Jean Delvare + +2 recommended fixes from upstream: +- dmidecode-only-scan-dev-mem-for-entry-point-on-x86.patch: Only + scan /dev/mem for entry point on x86 (fixes reboot on ARM64). +- dmidecode-fix-formatting-of-tpm-table-output.patch: Fix + formatting of TPM table output (missing newlines). + ------------------------------------------------------------------- Wed Jan 16 09:23:52 UTC 2019 - jdelvare@suse.de diff --git a/dmidecode.spec b/dmidecode.spec index a6fb080..09cadeb 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -29,6 +29,8 @@ Source1: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{vers Source2: %{name}.keyring Patch1: dmidecode-fix-redfish-hostname-print-length.patch Patch2: dmidecode-add-logical-non-volatile-device.patch +Patch3: dmidecode-only-scan-dev-mem-for-entry-point-on-x86.patch +Patch4: dmidecode-fix-formatting-of-tpm-table-output.patch Provides: pmtools:%{_sbindir}/dmidecode Obsoletes: pmtools < 20071117 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -53,6 +55,8 @@ the BIOS told it to. %setup -q %patch1 -p1 %patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build make CFLAGS="%{optflags}" %{?_smp_mflags}