From 715b44b5163c3ead4fa58113a72745c57dc5fa2b Mon Sep 17 00:00:00 2001 From: Lichen Liu Date: Wed, 20 Dec 2023 13:56:13 +0800 Subject: [PATCH] Rebase upstream 3.5 Resolves: RHEL-15487 Resolves: RHEL-16484 Signed-off-by: Lichen Liu --- .gitignore | 1 + ...-read_file-when-reading-from-a-dump-.patch | 64 +++++++++++++++++++ dmidecode.spec | 18 ++---- sources | 1 + 4 files changed, 72 insertions(+), 12 deletions(-) create mode 100644 0001-Consistently-use-read_file-when-reading-from-a-dump-.patch diff --git a/.gitignore b/.gitignore index 315f6f4..9aedc52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ SOURCES/dmidecode-3.3.tar.xz /dmidecode-3.3.tar.xz +/dmidecode-3.5.tar.xz diff --git a/0001-Consistently-use-read_file-when-reading-from-a-dump-.patch b/0001-Consistently-use-read_file-when-reading-from-a-dump-.patch new file mode 100644 index 0000000..e1f41bd --- /dev/null +++ b/0001-Consistently-use-read_file-when-reading-from-a-dump-.patch @@ -0,0 +1,64 @@ +From c76ddda0ba0aa99a55945e3290095c2ec493c892 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Wed, 26 Apr 2023 15:44:27 +0200 +Subject: [PATCH] Consistently use read_file() when reading from a dump file + +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 +Tested-by: Jerry Hoemann +--- + dmidecode.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 54f59c1..52ddbf1 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -6025,17 +6025,25 @@ int main(int argc, char * const argv[]) + pr_comment("dmidecode %s", VERSION); + + /* Read from dump if so instructed */ ++ size = 0x20; + if (opt.flags & FLAG_FROM_DUMP) + { + if (!(opt.flags & FLAG_QUIET)) + pr_info("Reading SMBIOS/DMI data from file %s.", + opt.dumpfile); +- if ((buf = mem_chunk(0, 0x20, opt.dumpfile)) == NULL) ++ if ((buf = read_file(0, &size, opt.dumpfile)) == NULL) + { + ret = 1; + goto exit_free; + } + ++ /* Truncated entry point can't be processed */ ++ if (size < 0x20) ++ { ++ ret = 1; ++ goto done; ++ } ++ + if (memcmp(buf, "_SM3_", 5) == 0) + { + if (smbios3_decode(buf, opt.dumpfile, 0)) +@@ -6059,7 +6067,6 @@ 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(0, &size, SYS_ENTRY_FILE)) != NULL) + { +-- +2.43.0 + diff --git a/dmidecode.spec b/dmidecode.spec index a84da79..cdd3ab2 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -1,22 +1,13 @@ Summary: Tool to analyse BIOS DMI data Name: dmidecode -Version: 3.3 -Release: 5%{?dist} +Version: 3.5 +Release: 1%{?dist} Epoch: 1 License: GPLv2+ Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz URL: http://www.nongnu.org/dmidecode/ -Patch0: 0001-dmidecode-Add-new-system-slot-types-from-SMBIOS-spec.patch -Patch1: 0002-dmidecode-Add-new-processor-characteristics-bits-from-SMBIOS-s.patch -Patch2: 0003-dmidecode-Missing-comma-in-the-dmi_slot_type.patch -Patch3: 0004-dmidecode-Skip-details-of-uninstalled-memory-modules.patch -Patch4: 0005-dmidecode-Add-new-processor-upgrades-from-SMBIOS-spec-3.4.0.patch -Patch5: 0006-dmidecode-Add-new-memory-device-types-from-SMBIOS-spec-3.4.0.patch -Patch6: 0007-dmidecode-Fix-crash-with-u-option.patch -Patch7: 0008-dmidecode-Split-table-fetching-from-decoding.patch -Patch8: 0009-dmidecode-Write-the-whole-dump-file-at-once.patch -Patch9: 0010-dmidecode-Do-not-let-dump-bin-overwrite-an-existing-.patch +Patch0: 0001-Consistently-use-read_file-when-reading-from-a-dump-.patch BuildRequires: gcc make ExclusiveArch: %{ix86} x86_64 ia64 aarch64 @@ -54,6 +45,9 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install- %{_mandir}/man8/* %changelog +* Wed Dec 20 2023 Lichen Liu - 1:3.5-1 +- Rebase to upstream 3.5 + * Thu Jun 08 2023 Lichen Liu - 1:3.3-5 - Resolves: rhbz#2186860 diff --git a/sources b/sources index db343ed..316f9a7 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (dmidecode-3.3.tar.xz) = dc77f40a7898011cea1b747d4677be2fbe8f52ec6ac460a5656de2f3389eca83bc416d6494acbe759971b5afce37b78f21ab55c34d62b1105b800e31566d1d22 +SHA512 (dmidecode-3.5.tar.xz) = 690c9bea391f6bbfc8cd48e8db408a61d5b551a07a2823c29d03a09607fc2043cc1bea44ee9fd27fd0e7bc0b287bf9de9f22a1a66053f5b1e63d77c03d93e1ae