diff options
author | Patrick J Volkerding <volkerdi@slackware.com> | 2018-05-28 19:12:29 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2018-05-31 23:39:35 +0200 |
commit | 646a5c1cbfd95873950a87b5f75d52073a967023 (patch) | |
tree | b8b8d2ab3b0d432ea69ad1a64d1c789649d65020 /source/ap/dmidecode | |
parent | d31c50870d0bee042ce660e445c9294a59a3a65b (diff) | |
download | current-646a5c1cbfd95873950a87b5f75d52073a967023.tar.gz |
Mon May 28 19:12:29 UTC 201820180528191229
a/pkgtools-15.0-noarch-13.txz: Rebuilt.
installpkg: default line length for --terselength is the number of columns.
removepkg: added --terse mode.
upgradepkg: default line length for --terselength is the number of columns.
upgradepkg: accept -option in addition to --option.
ap/vim-8.1.0026-x86_64-1.txz: Upgraded.
d/bison-3.0.5-x86_64-1.txz: Upgraded.
e/emacs-26.1-x86_64-1.txz: Upgraded.
kde/kopete-4.14.3-x86_64-8.txz: Rebuilt.
Recompiled against libidn-1.35.
n/conntrack-tools-1.4.5-x86_64-1.txz: Upgraded.
n/libnetfilter_conntrack-1.0.7-x86_64-1.txz: Upgraded.
n/libnftnl-1.1.0-x86_64-1.txz: Upgraded.
n/links-2.16-x86_64-2.txz: Rebuilt.
Rebuilt to enable X driver for -g mode.
n/lynx-2.8.9dev.19-x86_64-1.txz: Upgraded.
n/nftables-0.8.5-x86_64-1.txz: Upgraded.
n/p11-kit-0.23.11-x86_64-1.txz: Upgraded.
n/ulogd-2.0.7-x86_64-1.txz: Upgraded.
n/whois-5.3.1-x86_64-1.txz: Upgraded.
xap/network-manager-applet-1.8.12-x86_64-1.txz: Upgraded.
xap/vim-gvim-8.1.0026-x86_64-1.txz: Upgraded.
Diffstat (limited to 'source/ap/dmidecode')
11 files changed, 16 insertions, 606 deletions
diff --git a/source/ap/dmidecode/dmidecode.SlackBuild b/source/ap/dmidecode/dmidecode.SlackBuild index 824d2355..0b338c75 100755 --- a/source/ap/dmidecode/dmidecode.SlackBuild +++ b/source/ap/dmidecode/dmidecode.SlackBuild @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash -# Copyright 2006, 2007, 2008, 2009, 2010, 2011 Patrick J. Volkerding, Sebeka, MN, USA +# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2018 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -20,10 +20,11 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +cd $(dirname $0) ; CWD=$(pwd) PKGNAM=dmidecode VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then @@ -35,9 +36,16 @@ if [ -z "$ARCH" ]; then esac fi +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + NUMJOBS=${NUMJOBS:-" -j7 "} -CWD=$(pwd) TMP=${TMP:-/tmp} PKG=$TMP/package-${PKGNAM} rm -rf $PKG @@ -64,19 +72,6 @@ find . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; -# Upstream recommends taking four of these on top of 3.0 anyway, and the others -# look reasonable too, so here are all of the patches from git after 3.0 -# Upsream recommends: 1, 5, 7, and 8 -zcat $CWD/patches/0001-Add-no-sysfs-option-description-to-h-output.patch.gz | patch -p1 --verbose || exit 1 -zcat $CWD/patches/0002-Avoid-SIGBUS-on-mmap-failure.patch.gz | patch -p1 --verbose || exit 1 -zcat $CWD/patches/0003-Fix-error-paths-in-mem_chunk.patch.gz | patch -p1 --verbose || exit 1 -zcat $CWD/patches/0004-dmidecode-Handle-OEM-specific-types-in-group-associa.patch.gz | patch -p1 --verbose || exit 1 -zcat $CWD/patches/0005-Fix-No-SMBIOS-nor-DMI-entry-point-found-on-SMBIOS3.patch.gz | patch -p1 --verbose || exit 1 -zcat $CWD/patches/0006-dmidecode-Introduce-SYS_FIRMWARE_DIR.patch.gz | patch -p1 --verbose || exit 1 -zcat $CWD/patches/0007-Let-read_file-return-the-actual-data-size.patch.gz | patch -p1 --verbose || exit 1 -zcat $CWD/patches/0008-dmidecode-Use-read_file-to-read-the-DMI-table-from-s.patch.gz | patch -p1 --verbose || exit 1 -zcat $CWD/patches/0009-dmidecode-Check-sysfs-entry-point-length.patch.gz | patch -p1 --verbose || exit 1 - # Build and install: make prefix=/usr mandir=/usr/man $NUMJOBS || make prefix=/usr mandir=/usr/man || exit 1 make prefix=/usr mandir=/usr/man install DESTDIR=$PKG || exit 1 diff --git a/source/ap/dmidecode/patches/0001-Add-no-sysfs-option-description-to-h-output.patch b/source/ap/dmidecode/patches/0001-Add-no-sysfs-option-description-to-h-output.patch deleted file mode 100644 index 35b02974..00000000 --- a/source/ap/dmidecode/patches/0001-Add-no-sysfs-option-description-to-h-output.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 33b5aafc6ee6b5de9f2526fb1cf4b14d1e16e4f0 Mon Sep 17 00:00:00 2001 -From: Roy Franz <roy.franz@linaro.org> -Date: Thu, 1 Oct 2015 08:41:43 +0200 -Subject: [PATCH 1/9] Add "--no-sysfs" option description to -h output - -A description of --no-sysfs was not added to the output of "-h" when -the feature was added, so add it now. ---- - CHANGELOG | 4 ++++ - dmiopt.c | 1 + - 2 files changed, 5 insertions(+) - -diff --git a/CHANGELOG b/CHANGELOG -index f0a51a4..42d815c 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -1,3 +1,7 @@ -+2015-10-01 Roy Franz <roy.franz@linaro.org> -+ -+ * dmiopt.c: Add "--no-sysfs" option description to -h output. -+ - 2015-09-03 Jean Delvare <jdelvare@suse.de> - - * version.h: Set version to 3.0. -diff --git a/dmiopt.c b/dmiopt.c -index 0d142d2..de607f4 100644 ---- a/dmiopt.c -+++ b/dmiopt.c -@@ -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); --- -2.6.4 - diff --git a/source/ap/dmidecode/patches/0002-Avoid-SIGBUS-on-mmap-failure.patch b/source/ap/dmidecode/patches/0002-Avoid-SIGBUS-on-mmap-failure.patch deleted file mode 100644 index 924a2ffe..00000000 --- a/source/ap/dmidecode/patches/0002-Avoid-SIGBUS-on-mmap-failure.patch +++ /dev/null @@ -1,74 +0,0 @@ -From c081fa410e7c466df4b3b257e7b974b71fb7f250 Mon Sep 17 00:00:00 2001 -From: Jean Delvare <jdelvare@suse.de> -Date: Wed, 14 Oct 2015 14:37:04 +0200 -Subject: [PATCH 2/9] Avoid SIGBUS on mmap failure - -mmap will fail with SIGBUS if trying to map a non-existent portion of -a file. While this should never happen with /dev/mem, it can happen if -passing a regular file with option -d. While people should no longer -do that, failure gracefully seems better than crashing. So check for -the file size before calling mmap. - -This closes bug #46066: -http://savannah.nongnu.org/bugs/?46066 ---- - CHANGELOG | 6 ++++++ - util.c | 21 +++++++++++++++++++++ - 2 files changed, 27 insertions(+) - -diff --git a/CHANGELOG b/CHANGELOG -index 42d815c..aa1c28f 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -1,3 +1,9 @@ -+2015-10-14 Jean Delvare <jdelvare@suse.de> -+ -+ * util.c: Avoid SIGBUS on mmap failure. -+ This fixes Savannah bug #46066: -+ https://savannah.nongnu.org/bugs/?46066 -+ - 2015-10-01 Roy Franz <roy.franz@linaro.org> - - * dmiopt.c: Add "--no-sysfs" option description to -h output. -diff --git a/util.c b/util.c -index 8cafe5c..5795d02 100644 ---- a/util.c -+++ b/util.c -@@ -152,6 +152,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) - void *p; - int fd; - #ifdef USE_MMAP -+ struct stat statbuf; - off_t mmoffset; - void *mmp; - #endif -@@ -169,6 +170,26 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) - } - - #ifdef USE_MMAP -+ if (fstat(fd, &statbuf) == -1) -+ { -+ fprintf(stderr, "%s: ", devmem); -+ perror("stat"); -+ free(p); -+ return NULL; -+ } -+ -+ /* -+ * mmap() will fail with SIGBUS if trying to map beyond the end of -+ * the file. -+ */ -+ if (S_ISREG(statbuf.st_mode) && base + (off_t)len > statbuf.st_size) -+ { -+ fprintf(stderr, "mmap: Can't map beyond end of file %s\n", -+ devmem); -+ free(p); -+ return NULL; -+ } -+ - #ifdef _SC_PAGESIZE - mmoffset = base % sysconf(_SC_PAGESIZE); - #else --- -2.6.4 - diff --git a/source/ap/dmidecode/patches/0003-Fix-error-paths-in-mem_chunk.patch b/source/ap/dmidecode/patches/0003-Fix-error-paths-in-mem_chunk.patch deleted file mode 100644 index 7b4e418e..00000000 --- a/source/ap/dmidecode/patches/0003-Fix-error-paths-in-mem_chunk.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 458f73d58c24a7addce82bf1e8bfb8c2554ca458 Mon Sep 17 00:00:00 2001 -From: Jean Delvare <jdelvare@suse.de> -Date: Wed, 14 Oct 2015 14:37:09 +0200 -Subject: [PATCH 3/9] Fix error paths in mem_chunk - -Use a common error path in function mem_chunk, to make sure it does -not leak memory and does not leave an opened file descriptor behind, -without duplicating the cleaning code. ---- - CHANGELOG | 1 + - util.c | 24 ++++++++++-------------- - 2 files changed, 11 insertions(+), 14 deletions(-) - -diff --git a/CHANGELOG b/CHANGELOG -index aa1c28f..c940c9f 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -3,6 +3,7 @@ - * util.c: Avoid SIGBUS on mmap failure. - This fixes Savannah bug #46066: - https://savannah.nongnu.org/bugs/?46066 -+ * util.c: Fix error paths in mem_chunk. - - 2015-10-01 Roy Franz <roy.franz@linaro.org> - -diff --git a/util.c b/util.c -index 5795d02..f97ac0d 100644 ---- a/util.c -+++ b/util.c -@@ -166,7 +166,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) - if ((p = malloc(len)) == NULL) - { - perror("malloc"); -- return NULL; -+ goto out; - } - - #ifdef USE_MMAP -@@ -174,8 +174,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) - { - fprintf(stderr, "%s: ", devmem); - perror("stat"); -- free(p); -- return NULL; -+ goto err_free; - } - - /* -@@ -186,8 +185,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) - { - fprintf(stderr, "mmap: Can't map beyond end of file %s\n", - devmem); -- free(p); -- return NULL; -+ goto err_free; - } - - #ifdef _SC_PAGESIZE -@@ -220,19 +218,17 @@ try_read: - { - fprintf(stderr, "%s: ", devmem); - perror("lseek"); -- free(p); -- return NULL; -+ goto err_free; - } - -- if (myread(fd, p, len, devmem) == -1) -- { -- free(p); -- return NULL; -- } -+ if (myread(fd, p, len, devmem) == 0) -+ goto out; -+ -+err_free: -+ free(p); -+ p = NULL; - --#ifdef USE_MMAP - out: --#endif - if (close(fd) == -1) - perror(devmem); - --- -2.6.4 - diff --git a/source/ap/dmidecode/patches/0004-dmidecode-Handle-OEM-specific-types-in-group-associa.patch b/source/ap/dmidecode/patches/0004-dmidecode-Handle-OEM-specific-types-in-group-associa.patch deleted file mode 100644 index fad90f3a..00000000 --- a/source/ap/dmidecode/patches/0004-dmidecode-Handle-OEM-specific-types-in-group-associa.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 3acecbbab8ecaf3e3b324a2286e51cf9d7950ad5 Mon Sep 17 00:00:00 2001 -From: Jean Delvare <jdelvare@suse.de> -Date: Tue, 20 Oct 2015 08:47:15 +0200 -Subject: [PATCH 4/9] dmidecode: Handle OEM-specific types in group - associations - ---- - CHANGELOG | 5 +++++ - dmidecode.c | 2 ++ - 2 files changed, 7 insertions(+) - -diff --git a/CHANGELOG b/CHANGELOG -index c940c9f..2aa1082 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -1,3 +1,8 @@ -+2015-10-20 Jean Delvare <jdelvare@suse.de> -+ -+ * dmidecode.c: Handle OEM-specific types in group associations -+ (DMI type 14). -+ - 2015-10-14 Jean Delvare <jdelvare@suse.de> - - * util.c: Avoid SIGBUS on mmap failure. -diff --git a/dmidecode.c b/dmidecode.c -index f41c85b..ce0511b 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -172,6 +172,8 @@ static const char *dmi_smbios_structure_type(u8 code) - "Management Controller Host Interface", /* 42 */ - }; - -+ if (code >= 128) -+ return "OEM-specific"; - if (code <= 42) - return type[code]; - return out_of_spec; --- -2.6.4 - diff --git a/source/ap/dmidecode/patches/0005-Fix-No-SMBIOS-nor-DMI-entry-point-found-on-SMBIOS3.patch b/source/ap/dmidecode/patches/0005-Fix-No-SMBIOS-nor-DMI-entry-point-found-on-SMBIOS3.patch deleted file mode 100644 index a0eb3789..00000000 --- a/source/ap/dmidecode/patches/0005-Fix-No-SMBIOS-nor-DMI-entry-point-found-on-SMBIOS3.patch +++ /dev/null @@ -1,63 +0,0 @@ -From bf7bad24ce141dab5b5acc3ffb98ce5fe4a8e0f9 Mon Sep 17 00:00:00 2001 -From: Xie XiuQi <xiexiuqi@huawei.com> -Date: Wed, 21 Oct 2015 15:12:50 +0200 -Subject: [PATCH 5/9] Fix 'No SMBIOS nor DMI entry point found' on SMBIOS3 - -address_from_efi may return a SMBIOS or SMBIOS3 format entry -point, so add this condition. ---- - AUTHORS | 1 + - CHANGELOG | 4 ++++ - dmidecode.c | 12 ++++++++++-- - 3 files changed, 15 insertions(+), 2 deletions(-) - -diff --git a/AUTHORS b/AUTHORS -index d4badfa..ccf7fbb 100644 ---- a/AUTHORS -+++ b/AUTHORS -@@ -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 -diff --git a/CHANGELOG b/CHANGELOG -index 2aa1082..be2092a 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -1,3 +1,7 @@ -+2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> -+ -+ * dmidecode.c: Handle SMBIOS 3.0 entry points on EFI systems. -+ - 2015-10-20 Jean Delvare <jdelvare@suse.de> - - * dmidecode.c: Handle OEM-specific types in group associations -diff --git a/dmidecode.c b/dmidecode.c -index ce0511b..cfcade4 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -4866,8 +4866,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: --- -2.6.4 - diff --git a/source/ap/dmidecode/patches/0006-dmidecode-Introduce-SYS_FIRMWARE_DIR.patch b/source/ap/dmidecode/patches/0006-dmidecode-Introduce-SYS_FIRMWARE_DIR.patch deleted file mode 100644 index 8e03c89e..00000000 --- a/source/ap/dmidecode/patches/0006-dmidecode-Introduce-SYS_FIRMWARE_DIR.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 2330b708a6d57fd2b8b7e353dd64d037f980a042 Mon Sep 17 00:00:00 2001 -From: Jean Delvare <jdelvare@suse.de> -Date: Mon, 2 Nov 2015 09:45:13 +0100 -Subject: [PATCH 6/9] dmidecode: Introduce SYS_FIRMWARE_DIR - -Have SYS_FIRMWARE_DIR point to the sysfs directory where our files -live, and use it in the definition of their paths. This makes it -easier to temporarily point somewhere else for debugging. ---- - dmidecode.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/dmidecode.c b/dmidecode.c -index cfcade4..183ced4 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -74,8 +74,9 @@ static const char *bad_index = "<BAD INDEX>"; - #define FLAG_NO_FILE_OFFSET (1 << 0) - #define FLAG_STOP_AT_EOT (1 << 1) - --#define SYS_ENTRY_FILE "/sys/firmware/dmi/tables/smbios_entry_point" --#define SYS_TABLE_FILE "/sys/firmware/dmi/tables/DMI" -+#define SYS_FIRMWARE_DIR "/sys/firmware/dmi/tables" -+#define SYS_ENTRY_FILE SYS_FIRMWARE_DIR "/smbios_entry_point" -+#define SYS_TABLE_FILE SYS_FIRMWARE_DIR "/DMI" - - /* - * Type-independant Stuff --- -2.6.4 - diff --git a/source/ap/dmidecode/patches/0007-Let-read_file-return-the-actual-data-size.patch b/source/ap/dmidecode/patches/0007-Let-read_file-return-the-actual-data-size.patch deleted file mode 100644 index 22e2f724..00000000 --- a/source/ap/dmidecode/patches/0007-Let-read_file-return-the-actual-data-size.patch +++ /dev/null @@ -1,112 +0,0 @@ -From de9a74e1c60210bee229fcf55b1678a99d1b44dd Mon Sep 17 00:00:00 2001 -From: Jean Delvare <jdelvare@suse.de> -Date: Mon, 2 Nov 2015 09:45:26 +0100 -Subject: [PATCH 7/9] Let read_file return the actual data size - -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. ---- - CHANGELOG | 5 +++++ - dmidecode.c | 4 +++- - util.c | 11 +++++++---- - util.h | 2 +- - 4 files changed, 16 insertions(+), 6 deletions(-) - -diff --git a/CHANGELOG b/CHANGELOG -index be2092a..1e5437a 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -1,3 +1,8 @@ -+2015-11-02 Jean Delvare <jdelvare@suse.de> -+ -+ * dmidecode.c, util.c, util.h: Let read_file return the actual data -+ size. -+ - 2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> - - * dmidecode.c: Handle SMBIOS 3.0 entry points on EFI systems. -diff --git a/dmidecode.c b/dmidecode.c -index 183ced4..a43cfd1 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -4751,6 +4751,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; - -@@ -4820,8 +4821,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"); -diff --git a/util.c b/util.c -index f97ac0d..52ed413 100644 ---- a/util.c -+++ b/util.c -@@ -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 char *filename) - 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 char *filename) - - 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 char *filename) - while (r != 0); - - close(fd); -+ *max_len = r2; -+ - return p; - } - -diff --git a/util.h b/util.h -index 9d409cd..b8748f1 100644 ---- a/util.h -+++ b/util.h -@@ -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); --- -2.6.4 - diff --git a/source/ap/dmidecode/patches/0008-dmidecode-Use-read_file-to-read-the-DMI-table-from-s.patch b/source/ap/dmidecode/patches/0008-dmidecode-Use-read_file-to-read-the-DMI-table-from-s.patch deleted file mode 100644 index f0dc5aed..00000000 --- a/source/ap/dmidecode/patches/0008-dmidecode-Use-read_file-to-read-the-DMI-table-from-s.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 364055211b1956539c6a6268e111e244e1292c8c Mon Sep 17 00:00:00 2001 -From: Jean Delvare <jdelvare@suse.de> -Date: Mon, 2 Nov 2015 09:45:31 +0100 -Subject: [PATCH 8/9] dmidecode: Use read_file() to read the DMI table from - sysfs - -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 ---- - CHANGELOG | 3 +++ - dmidecode.c | 29 +++++++++++++++++++++-------- - 2 files changed, 24 insertions(+), 8 deletions(-) - -diff --git a/CHANGELOG b/CHANGELOG -index 1e5437a..fcfc244 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -2,6 +2,9 @@ - - * dmidecode.c, util.c, util.h: Let read_file return the actual data - size. -+ * dmidecode.c: Use read_file to read the DMI table from sysfs. -+ This fixes Savannah bug #46176: -+ https://savannah.nongnu.org/bugs/?46176 - - 2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> - -diff --git a/dmidecode.c b/dmidecode.c -index a43cfd1..16d1823 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -4524,16 +4524,29 @@ static void dmi_table(off_t base, u32 len, u16 num, u16 ver, const char *devmem, - 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 --- -2.6.4 - diff --git a/source/ap/dmidecode/patches/0009-dmidecode-Check-sysfs-entry-point-length.patch b/source/ap/dmidecode/patches/0009-dmidecode-Check-sysfs-entry-point-length.patch deleted file mode 100644 index 6af8b322..00000000 --- a/source/ap/dmidecode/patches/0009-dmidecode-Check-sysfs-entry-point-length.patch +++ /dev/null @@ -1,52 +0,0 @@ -From e5c73239404931d4d1b73eb595c3802fbce74c61 Mon Sep 17 00:00:00 2001 -From: Jean Delvare <jdelvare@suse.de> -Date: Mon, 2 Nov 2015 09:45:36 +0100 -Subject: [PATCH 9/9] dmidecode: Check sysfs entry point length - -Before passing the sysfs entry point data over for decoding, check -that its length meets the expectations. ---- - CHANGELOG | 1 + - dmidecode.c | 6 +++--- - 2 files changed, 4 insertions(+), 3 deletions(-) - -diff --git a/CHANGELOG b/CHANGELOG -index fcfc244..ba61cab 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -5,6 +5,7 @@ - * dmidecode.c: Use read_file to read the DMI table from sysfs. - This fixes Savannah bug #46176: - https://savannah.nongnu.org/bugs/?46176 -+ * dmidecode.c: Check the sysfs entry point length. - - 2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> - -diff --git a/dmidecode.c b/dmidecode.c -index 16d1823..b47c469 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -4840,17 +4840,17 @@ int main(int argc, char * const argv[]) - { - if (!(opt.flags & FLAG_QUIET)) - printf("Getting SMBIOS data from sysfs.\n"); -- if (memcmp(buf, "_SM3_", 5) == 0) -+ if (size >= 24 && memcmp(buf, "_SM3_", 5) == 0) - { - if (smbios3_decode(buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET)) - found++; - } -- else if (memcmp(buf, "_SM_", 4) == 0) -+ else if (size >= 31 && memcmp(buf, "_SM_", 4) == 0) - { - if (smbios_decode(buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET)) - found++; - } -- else if (memcmp(buf, "_DMI_", 5) == 0) -+ else if (size >= 15 && memcmp(buf, "_DMI_", 5) == 0) - { - if (legacy_decode(buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET)) - found++; --- -2.6.4 - diff --git a/source/ap/dmidecode/slack-desc b/source/ap/dmidecode/slack-desc index d7fd45cd..77503e8b 100644 --- a/source/ap/dmidecode/slack-desc +++ b/source/ap/dmidecode/slack-desc @@ -1,15 +1,15 @@ # HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line +# The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' -# on the right side marks the last column you can put a character in. You must -# make exactly 11 lines for the formatting to be correct. It's also +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. |-----handy-ruler------------------------------------------------------| dmidecode: dmidecode (DMI table decoder) dmidecode: dmidecode: dmidecode is a tool for dumping a computer's DMI table (some say -dmidecode: SMBIOS) contents in a human-readable format. This table contains a +dmidecode: SMBIOS) contents in a human-readable format. This table contains a dmidecode: description of the system's hardware components, as well as other dmidecode: useful pieces of information such as serial numbers and BIOS dmidecode: revision. |