From 7662e32efcfb27fb4cb50ff1aec6f6eee0de698eda90858fd0b8602c8a3b3e39 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Fri, 9 Jul 2021 09:04:28 +0000 Subject: [PATCH] Accepting request 905202 from home:trenn:branches:Base:System - Enhance _service file - Update to version 0.7.3: * Add SMBIOS 3.x support * Read DMI entries from /sys/firmware/dmi/tables/DMI * Add buffer read helper using read explicitly * man: fix all_ethN indentation * Netronome biosdevname support (#8) * Prevent infinite recursion in dmidecode.c::smbios_setslot by (#7) * Add support for ExaNIC network cards (#5) This are now all mainline and got reverted: D biosdevname-Add-buffer-read-helper-using-read-explicitly.patch D biosdevname-Add-SMBIOS-3.x-support.patch D biosdevname-Read-DMI-entries-from-sys-firmware-dmi-tables-DMI.patch D dmidecode-prevent-infinite-recursion.patch OBS-URL: https://build.opensuse.org/request/show/905202 OBS-URL: https://build.opensuse.org/package/show/Base:System/biosdevname?expand=0&rev=83 --- _service | 15 +- _servicedata | 2 +- biosdevname-0.7.3.7.g495ab76.obscpio | 3 + biosdevname-0.7.3.tar.xz | 3 - biosdevname-Add-SMBIOS-3.x-support.patch | 61 ------- ...er-read-helper-using-read-explicitly.patch | 166 ------------------ ...ies-from-sys-firmware-dmi-tables-DMI.patch | 143 --------------- biosdevname.changes | 20 +++ biosdevname.obsinfo | 5 + biosdevname.spec | 8 +- dmidecode-prevent-infinite-recursion.patch | 13 -- 11 files changed, 39 insertions(+), 400 deletions(-) create mode 100644 biosdevname-0.7.3.7.g495ab76.obscpio delete mode 100644 biosdevname-0.7.3.tar.xz delete mode 100644 biosdevname-Add-SMBIOS-3.x-support.patch delete mode 100644 biosdevname-Add-buffer-read-helper-using-read-explicitly.patch delete mode 100644 biosdevname-Read-DMI-entries-from-sys-firmware-dmi-tables-DMI.patch create mode 100644 biosdevname.obsinfo delete mode 100644 dmidecode-prevent-infinite-recursion.patch diff --git a/_service b/_service index 7b2d59a..922c8a1 100644 --- a/_service +++ b/_service @@ -1,15 +1,16 @@ - + git https://github.com/dell/biosdevname.git - - biosdevname - 0.7.2 + master + v(.*) + @PARENT_TAG@.@TAG_OFFSET@.g%h enable - - biosdevname*.tar + + + + *.tar xz - diff --git a/_servicedata b/_servicedata index c939dbe..8eea092 100644 --- a/_servicedata +++ b/_servicedata @@ -1,4 +1,4 @@ https://github.com/dell/biosdevname.git - 02811d5165c2eeecf8797fe9b5088d6e78bd25db + 495ab76e0d5f0eba83f9c86baf779a244ea1b60d \ No newline at end of file diff --git a/biosdevname-0.7.3.7.g495ab76.obscpio b/biosdevname-0.7.3.7.g495ab76.obscpio new file mode 100644 index 0000000..2060623 --- /dev/null +++ b/biosdevname-0.7.3.7.g495ab76.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:914b1282c801e293b3477c970d3417a6c2a5f23aea988d75d4c2994471b06bb4 +size 368651 diff --git a/biosdevname-0.7.3.tar.xz b/biosdevname-0.7.3.tar.xz deleted file mode 100644 index 7ee1f4e..0000000 --- a/biosdevname-0.7.3.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2773c0ea7acd3544d6e17ed176642dbdda6e5e8cfd8c42b7cf56cbd55894d068 -size 83296 diff --git a/biosdevname-Add-SMBIOS-3.x-support.patch b/biosdevname-Add-SMBIOS-3.x-support.patch deleted file mode 100644 index d1db5ee..0000000 --- a/biosdevname-Add-SMBIOS-3.x-support.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 8459b891cdbb2d4691bd188ced5a512be8734d10 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 13 Aug 2020 16:11:06 +0200 -Subject: [PATCH 3/3] Add SMBIOS 3.x support - -Handle only the path from sysfs for now. - -Signed-off-by: Takashi Iwai ---- - src/dmidecode/dmidecode.c | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - -diff --git a/src/dmidecode/dmidecode.c b/src/dmidecode/dmidecode.c -index f4c12694ef13..f478cc58aeb6 100644 ---- a/src/dmidecode/dmidecode.c -+++ b/src/dmidecode/dmidecode.c -@@ -236,7 +236,7 @@ static int dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, co - int i=0; - - /* Verify SMBIOS version */ -- if (!isvalidsmbios(ver >> 8, ver & 0xFF)) { -+ if (ver && !isvalidsmbios(ver >> 8, ver & 0xFF)) { - return 0; - } - -@@ -253,7 +253,7 @@ static int dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, co - } - - data=buf; -- while(i= 0x18 && memcmp(buf, "_SM3_", 5) == 0) -+ return smbios3_decode(buf, SYSFS_TABLE_DMI, state); - return 0; - } - --- -2.16.4 - diff --git a/biosdevname-Add-buffer-read-helper-using-read-explicitly.patch b/biosdevname-Add-buffer-read-helper-using-read-explicitly.patch deleted file mode 100644 index a958506..0000000 --- a/biosdevname-Add-buffer-read-helper-using-read-explicitly.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 2a6b7a70e15a0b7aae4fb9de2630f3ae1b4de64e Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 13 Aug 2020 13:21:59 +0200 -Subject: [PATCH 1/3] Add buffer read helper using read explicitly - -Since mmap can't work well with a sysfs file, we need to read the -contents explicitly via read, even if USE_MMAP is enabled. -Provide a new helper, __mem_cunk(), that does behave like mem_chunk() -but with the extra use_mmap argument to specify the method to read a -file. - -Signed-off-by: Takashi Iwai ---- - src/dmidecode/util.c | 82 +++++++++++++++++++++++++++++++++------------------- - src/dmidecode/util.h | 1 + - 2 files changed, 53 insertions(+), 30 deletions(-) - -diff --git a/src/dmidecode/util.c b/src/dmidecode/util.c -index ea06663d3664..09934eabcf24 100644 ---- a/src/dmidecode/util.c -+++ b/src/dmidecode/util.c -@@ -47,7 +47,6 @@ - #include "types.h" - #include "util.h" - --#ifndef USE_MMAP - static int myread(int fd, u8 *buf, size_t count, const char *prefix) - { - ssize_t r=1; -@@ -78,7 +77,6 @@ static int myread(int fd, u8 *buf, size_t count, const char *prefix) - - return 0; - } --#endif - - int checksum(const u8 *buf, size_t len) - { -@@ -94,28 +92,13 @@ int checksum(const u8 *buf, size_t len) - * Copy a physical memory chunk into a memory buffer. - * This function allocates memory. - */ --void *mem_chunk(size_t base, size_t len, const char *devmem) --{ -- void *p; -- int fd; - #ifdef USE_MMAP -+static void *mem_chunk_mmap(size_t base, size_t len, const char *devmem, -+ int fd, void *p) -+{ - size_t mmoffset; - void *mmp; --#endif -- -- if((fd=open(devmem, O_RDONLY))==-1) -- { -- return NULL; -- } -- -- if((p=malloc(len))==NULL) -- { -- perror("malloc"); -- close(fd); -- return NULL; -- } -- --#ifdef USE_MMAP -+ - #ifdef _SC_PAGESIZE - mmoffset=base%sysconf(_SC_PAGESIZE); - #else -@@ -129,8 +112,6 @@ void *mem_chunk(size_t base, size_t len, const char *devmem) - mmp=mmap(0, mmoffset+len, PROT_READ, MAP_SHARED, fd, base-mmoffset); - if(mmp==MAP_FAILED) - { -- free(p); -- close(fd); - return NULL; - } - -@@ -141,26 +122,67 @@ void *mem_chunk(size_t base, size_t len, const char *devmem) - fprintf(stderr, "%s: ", devmem); - perror("munmap"); - } --#else /* USE_MMAP */ -+ -+ return p; -+} -+#endif /* USE_MMAP */ -+ -+static void *mem_chunk_read(size_t base, size_t len, const char *devmem, -+ int fd, void *p) -+{ - if(lseek(fd, base, SEEK_SET)==-1) - { - fprintf(stderr, "%s: ", devmem); - perror("lseek"); -- free(p); -- close(fd); - return NULL; - } - - if(myread(fd, p, len, devmem)==-1) - { -- free(p); -- close(fd); - return NULL; - } --#endif /* USE_MMAP */ -+ -+ return p; -+} -+ -+void *__mem_chunk(size_t base, size_t len, const char *devmem, int use_mmap) -+{ -+ void *ret; -+ void *p; -+ int fd; -+ -+#ifndef USE_MMAP -+ use_mmap = 0; -+#endif -+ -+ if((fd=open(devmem, O_RDONLY))==-1) -+ { -+ return NULL; -+ } - -+ if((p=malloc(len))==NULL) -+ { -+ perror("malloc"); -+ close(fd); -+ return NULL; -+ } -+ -+#ifdef USE_MMAP -+ if (use_mmap) -+ ret = mem_chunk_mmap(base, len, devmem, fd, p); -+ else -+#endif -+ ret = mem_chunk_read(base, len, devmem, fd, p); -+ - if(close(fd)==-1) - perror(devmem); -+ if (!ret) -+ free(p); - -- return p; -+ return ret; -+} -+ -+void *mem_chunk(size_t base, size_t len, const char *devmem) -+{ -+ return __mem_chunk(base, len, devmem, 1); - } -diff --git a/src/dmidecode/util.h b/src/dmidecode/util.h -index b546f64f3685..90c411e7bf9b 100644 ---- a/src/dmidecode/util.h -+++ b/src/dmidecode/util.h -@@ -6,3 +6,4 @@ - - int checksum(const u8 *buf, size_t len); - void *mem_chunk(size_t base, size_t len, const char *devmem); -+void *__mem_chunk(size_t base, size_t len, const char *devmem, int use_mmap); --- -2.16.4 - diff --git a/biosdevname-Read-DMI-entries-from-sys-firmware-dmi-tables-DMI.patch b/biosdevname-Read-DMI-entries-from-sys-firmware-dmi-tables-DMI.patch deleted file mode 100644 index a813ca2..0000000 --- a/biosdevname-Read-DMI-entries-from-sys-firmware-dmi-tables-DMI.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 345ea79e5f020e9776ba8de64b2dccad9df56584 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 13 Aug 2020 13:24:35 +0200 -Subject: [PATCH 2/3] Read DMI entries from /sys/firmware/dmi/tables/DMI - -A kernel with Secure Boot lockdown may prohibit reading the contents -of /dev/mem, hence biosdevname fails. The recent kernel provides the -DMI byte contents in /sys/firmware/dmi/tables/*, and we can use this -instead of poking /dev/mem. - -Signed-off-by: Takashi Iwai ---- - src/dmidecode/dmidecode.c | 54 +++++++++++++++++++++++++++++++++++------------ - 1 file changed, 41 insertions(+), 13 deletions(-) - -diff --git a/src/dmidecode/dmidecode.c b/src/dmidecode/dmidecode.c -index a01a6ce074f1..f4c12694ef13 100644 ---- a/src/dmidecode/dmidecode.c -+++ b/src/dmidecode/dmidecode.c -@@ -229,7 +229,7 @@ static int isvalidsmbios(int mjr, int mnr) - return 0; - } - --static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, const struct libbiosdevname_state *state) -+static int dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, const struct libbiosdevname_state *state, int sysfs) - { - u8 *buf; - u8 *data; -@@ -237,14 +237,19 @@ static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, c - - /* Verify SMBIOS version */ - if (!isvalidsmbios(ver >> 8, ver & 0xFF)) { -- return; -+ return 0; - } -- if((buf=mem_chunk(base, len, devmem))==NULL) -+ -+ if (sysfs) -+ buf = __mem_chunk(0, len, devmem, 0); -+ else -+ buf = mem_chunk(base, len, devmem); -+ if(buf == NULL) - { - #ifndef USE_MMAP - printf("Table is unreachable, sorry. Try compiling dmidecode with -DUSE_MMAP.\n"); - #endif -- return; -+ return 0; - } - - data=buf; -@@ -280,18 +285,18 @@ static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, c - i++; - } - free(buf); -+ return 1; - } - -- --static int smbios_decode(u8 *buf, const char *devmem, const struct libbiosdevname_state *state) -+static int smbios_decode(u8 *buf, const char *devmem, const struct libbiosdevname_state *state, int sysfs) - { - if(checksum(buf, buf[0x05]) - && memcmp(buf+0x10, "_DMI_", 5)==0 - && checksum(buf+0x10, 0x0F)) - { -- dmi_table(DWORD(buf+0x18), WORD(buf+0x16), WORD(buf+0x1C), -- (buf[0x06]<<8)+buf[0x07], devmem, state); -- return 1; -+ return dmi_table(DWORD(buf+0x18), WORD(buf+0x16), WORD(buf+0x1C), -+ (buf[0x06]<<8)+buf[0x07], devmem, state, -+ sysfs); - } - - return 0; -@@ -302,13 +307,32 @@ static int legacy_decode(u8 *buf, const char *devmem, const struct libbiosdevnam - if(checksum(buf, 0x0F)) - { - dmi_table(DWORD(buf+0x08), WORD(buf+0x06), WORD(buf+0x0C), -- ((buf[0x0E]&0xF0)<<4)+(buf[0x0E]&0x0F), devmem, state); -+ ((buf[0x0E]&0xF0)<<4)+(buf[0x0E]&0x0F), devmem, state, 0); - return 1; - } - - return 0; - } - -+#define SYSFS_TABLE_SMBIOS "/sys/firmware/dmi/tables/smbios_entry_point" -+#define SYSFS_TABLE_DMI "/sys/firmware/dmi/tables/DMI" -+ -+static int smibios_decode_from_sysfs(const struct libbiosdevname_state *state) -+{ -+ FILE *fp; -+ u8 buf[0x1f]; -+ int len; -+ -+ fp = fopen(SYSFS_TABLE_SMBIOS, "r"); -+ if (!fp) -+ return 0; -+ len = fread(buf, 1, sizeof(buf), fp); -+ fclose(fp); -+ if (len == 0x1f && memcmp(buf, "_SM_", 4) == 0) -+ return smbios_decode(buf, SYSFS_TABLE_DMI, state, 1); -+ return 0; -+} -+ - /* - * Probe for EFI interface - */ -@@ -417,7 +441,11 @@ int dmidecode_main(const struct libbiosdevname_state *state) - if (dmidecode_read_file(state)) - return 0; - -- /* First try EFI (ia64, Intel-based Mac) */ -+ /* First try sysfs entries */ -+ if (smibios_decode_from_sysfs(state)) -+ return 0; -+ -+ /* Next try EFI (ia64, Intel-based Mac) */ - efi=address_from_efi(&fp); - switch(efi) - { -@@ -434,7 +462,7 @@ int dmidecode_main(const struct libbiosdevname_state *state) - goto exit_free; - } - -- if(smbios_decode(buf, devmem, state)) -+ if(smbios_decode(buf, devmem, state, 0)) - found++; - goto done; - -@@ -450,7 +478,7 @@ memory_scan: - { - if(memcmp(buf+fp, "_SM_", 4)==0 && fp<=0xFFE0) - { -- if(smbios_decode(buf+fp, devmem, state)) -+ if(smbios_decode(buf+fp, devmem, state, 0)) - { - found++; - fp+=16; --- -2.16.4 - diff --git a/biosdevname.changes b/biosdevname.changes index db896a9..f93b82d 100644 --- a/biosdevname.changes +++ b/biosdevname.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Fri Jul 9 07:38:43 UTC 2021 - Thomas Renninger + +- Enhance _service file +- Update to version 0.7.3: + * Add SMBIOS 3.x support + * Read DMI entries from /sys/firmware/dmi/tables/DMI + * Add buffer read helper using read explicitly + * man: fix all_ethN indentation + * Netronome biosdevname support (#8) + * Prevent infinite recursion in dmidecode.c::smbios_setslot by (#7) + * Add support for ExaNIC network cards (#5) + +This are now all mainline and got reverted: +D biosdevname-Add-buffer-read-helper-using-read-explicitly.patch +D biosdevname-Add-SMBIOS-3.x-support.patch +D biosdevname-Read-DMI-entries-from-sys-firmware-dmi-tables-DMI.patch +D dmidecode-prevent-infinite-recursion.patch + ------------------------------------------------------------------- Tue Jun 8 09:39:44 UTC 2021 - Ludwig Nussel @@ -317,3 +336,4 @@ Mon Sep 3 00:00:00 CEST 2007 - bwalle@suse.de - initial package for SUSE (209107, FATE 301528) ------------------------------------------------------------------- +Mon Sep 3 00:00:00 CEST 2007 - diff --git a/biosdevname.obsinfo b/biosdevname.obsinfo new file mode 100644 index 0000000..7f70699 --- /dev/null +++ b/biosdevname.obsinfo @@ -0,0 +1,5 @@ +name: biosdevname +version: 0.7.3.7.g495ab76 +mtime: 1599238290 +commit: 495ab76e0d5f0eba83f9c86baf779a244ea1b60d + diff --git a/biosdevname.spec b/biosdevname.spec index e85020e..fc13470 100644 --- a/biosdevname.spec +++ b/biosdevname.spec @@ -18,7 +18,7 @@ %define _udevrulesdir %(pkg-config --variable=udevdir udev)/rules.d Name: biosdevname -Version: 0.7.3 +Version: 0.7.3.7.g495ab76 Release: 0 Summary: Udev helper for naming devices per BIOS names License: GPL-2.0-only @@ -30,10 +30,6 @@ Patch2: whitelist-dell Patch3: udev-rule-path.patch Patch4: biosdevname-pic.patch Patch5: biosdevname-dom0.patch -Patch6: dmidecode-prevent-infinite-recursion.patch -Patch7: biosdevname-Add-buffer-read-helper-using-read-explicitly.patch -Patch8: biosdevname-Read-DMI-entries-from-sys-firmware-dmi-tables-DMI.patch -Patch9: biosdevname-Add-SMBIOS-3.x-support.patch BuildRequires: automake BuildRequires: pciutils-devel BuildRequires: pkg-config @@ -44,7 +40,7 @@ BuildRequires: zlib-devel BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(udev) Requires(post): coreutils -Requires(postun): coreutils +Requires(postun):coreutils # for ownership of /usr/lib/udev/rules.d Requires: udev BuildRequires: pkgconfig(udev) diff --git a/dmidecode-prevent-infinite-recursion.patch b/dmidecode-prevent-infinite-recursion.patch deleted file mode 100644 index e669a1c..0000000 --- a/dmidecode-prevent-infinite-recursion.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: biosdevname-0.7.3/src/dmidecode/dmidecode.c -=================================================================== ---- biosdevname-0.7.3.orig/src/dmidecode/dmidecode.c -+++ biosdevname-0.7.3/src/dmidecode/dmidecode.c -@@ -153,7 +153,7 @@ void smbios_setslot(const struct libbios - } - - /* Found a PDEV, now is it a bridge? */ -- if (pdev->sbus != -1) { -+ if (pdev->sbus != -1 && pdev->sbus > bus) { - smbios_setslot(state, domain, pdev->sbus, -1, -1, type, slot, index, label); - } - }