From 76d60a3678ba2e69f7dda20ee57bf309ba088428 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 8 Feb 2022 10:58:55 +0100 Subject: [PATCH] - fixed invalid hex number (multipath) - santize devspec output of a newline if one is present --- ...ls-1.3.9-bootlist-invalid-hex-number.patch | 20 ++++++ ...-utils-1.3.9-sanitize-devspec-output.patch | 62 +++++++++++++++++++ powerpc-utils.spec | 22 ++++--- 3 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 powerpc-utils-1.3.9-bootlist-invalid-hex-number.patch create mode 100644 powerpc-utils-1.3.9-sanitize-devspec-output.patch diff --git a/powerpc-utils-1.3.9-bootlist-invalid-hex-number.patch b/powerpc-utils-1.3.9-bootlist-invalid-hex-number.patch new file mode 100644 index 0000000..9200040 --- /dev/null +++ b/powerpc-utils-1.3.9-bootlist-invalid-hex-number.patch @@ -0,0 +1,20 @@ +diff -up powerpc-utils-1.3.9/scripts/bootlist.me powerpc-utils-1.3.9/scripts/bootlist +--- powerpc-utils-1.3.9/scripts/bootlist.me 2022-02-08 10:55:22.056006203 +0100 ++++ powerpc-utils-1.3.9/scripts/bootlist 2022-02-08 10:55:57.400202890 +0100 +@@ -270,14 +270,14 @@ dm_to_part() + done + + +- kpartx -p $delim -l $dmmapper | while read kp ; do ++ kpartx -p "$delim" -l $dmmapper | while read kp ; do + kpname=${kp%% *} + tmajor=$(stat -L --format="%t" /dev/mapper/$kpname 2>/dev/null) + tminor=$(stat -L --format="%T" /dev/mapper/$kpname 2>/dev/null) + tmajmin=$(printf "%d:%d" 0x$tmajor 0x$tminor) + if [[ "$tmajmin" = "$dmpmajmin" ]]; then + partstart=${kp##* } +- for part in `ls -1d /sys/block/$sddev/$sddev*`; do ++ for part in `ls -1d /sys/block/$sddev/$sddev* 2>/dev/null`; do + pstart=$(cat $part/start 2>/dev/null) + if [[ "$pstart" -eq "$partstart" ]] ; then + echo "${part##*/}" diff --git a/powerpc-utils-1.3.9-sanitize-devspec-output.patch b/powerpc-utils-1.3.9-sanitize-devspec-output.patch new file mode 100644 index 0000000..e8d1f39 --- /dev/null +++ b/powerpc-utils-1.3.9-sanitize-devspec-output.patch @@ -0,0 +1,62 @@ +commit d8408b429ff022ff446ac2607bc26eaf60627658 +Author: Tyrel Datwyler +Date: Mon Jan 10 16:55:58 2022 -0500 + + errinjct: sanitize devspec output of a newline if one is present + + Linux Kernel Commit: 14c19b2a40b6 ("PCI/sysfs: Add 'devspec' newline") + introduced a newline character at the end of the devspec result which + historically did not have one before. When a newline is present the + errinjct utility constructs an invalid pathname for a PCI devices /reg + property in the device tree. As a result the tool fails to provide a + valid config address to RTAS resulting in a (-3) Parameter Error. + + errinjct eeh -v -f 6 -s net/eth1 -a 0xe0800000 -m 0xff800000 + errinjct: Could not open file /proc/device-tree//pci@800000020000154/ethernet@0,1 + /reg, No such file or directory + + Injecting an ioa-bus-error with the following data: + + BUS ADDR: e0800000 + ADDR MASK: ff800000 + CONFIG ADDR: 1 + PHB UNIT_ID: 800000020000154 + FUNCTION: 6 + Store to PCI Memory Address Space - inject an Address Parity Error + errinjct: RTAS error injection failed! + + errinjct: RTAS: ioa-bus-error: Argument error (-3) + + Fix this issue by nul terminating the devspec output string at the newline + if present. + + Signed-off-by: Tyrel Datwyler + +diff --git a/src/errinjct/ioa_bus_error.c b/src/errinjct/ioa_bus_error.c +index 281b56b..fc38037 100644 +--- a/src/errinjct/ioa_bus_error.c ++++ b/src/errinjct/ioa_bus_error.c +@@ -232,7 +232,7 @@ static int parse_sysfsname(void) + { + char path[BUFSZ]; + char *devspec; +- char *at; ++ char *at, *nl; + uint32_t addr; + uint64_t phb_id; + +@@ -247,6 +247,14 @@ static int parse_sysfsname(void) + if (!devspec) + return 1; + ++ /* Linux Kernel Commit: 14c19b2a40b6 ("PCI/sysfs: Add 'devspec' newline") ++ * began reporting the devspec value for pci devices with a trailing newline. ++ * Remove the newline if present to ensure our built pathname for obtaining ++ * the config address is valid. */ ++ nl = strchr(devspec, '\n'); ++ if (nl) ++ *nl = '\0'; ++ + /* Now we parse something like /pci@400000000112/pci@2/ethernet@1 for + * BUID HI =4000 and LOW 00000112 */ + at = strchr(devspec, '@'); diff --git a/powerpc-utils.spec b/powerpc-utils.spec index ff55599..bd6735a 100644 --- a/powerpc-utils.spec +++ b/powerpc-utils.spec @@ -1,16 +1,24 @@ Name: powerpc-utils Version: 1.3.9 -Release: 4%{?dist} +Release: 5%{?dist} Summary: PERL-based scripts for maintaining and servicing PowerPC systems License: GPLv2 URL: https://github.com/ibm-power-utilities/powerpc-utils Source0: https://github.com/ibm-power-utilities/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz Source1: nvsetenv +Patch1: powerpc-utils-1.3.8-man.patch +Patch2: powerpc-utils-1.3.9-makefile.patch +Patch3: powerpc-utils-1.3.5-pseries_platform-man.patch +Patch4: powerpc-utils-1.3.5-update_flash_nv.patch +Patch5: powerpc-utils-1.3.8-install-man.patch +Patch6: powerpc-utils-1.3.8-hcnmgr.patch +Patch7: powerpc-utils-1.3.9-sanitize-devspec-output.patch # enable support for vnic as backup device Patch8: powerpc-utils-support-vnic-as-backup-device-for-HNV.patch # fixed hexdump format Patch9: powerpc-utils-1.3.9-fix-hexdump-format.patch +Patch10: powerpc-utils-1.3.9-bootlist-invalid-hex-number.patch ExclusiveArch: ppc %{power64} @@ -29,14 +37,6 @@ BuildRequires: numactl-devel Requires: perl(Data::Dumper) Requires: %{name}-core = %{version}-%{release} -Patch1: powerpc-utils-1.3.8-man.patch -Patch2: powerpc-utils-1.3.9-makefile.patch -Patch3: powerpc-utils-1.3.5-pseries_platform-man.patch -Patch4: powerpc-utils-1.3.5-update_flash_nv.patch -Patch5: powerpc-utils-1.3.8-install-man.patch -Patch7: powerpc-utils-1.3.8-hcnmgr.patch - - %description PERL-based scripts for maintaining and servicing PowerPC systems. @@ -205,6 +205,10 @@ systemctl enable hcn-init.service >/dev/null 2>&1 || : %changelog +* Tue Feb 08 2022 Than Ngo - 1.3.9-5 +- santize devspec output of a newline if one is present +- fixed invalid hex number (multipath) + * Fri Jan 21 2022 Fedora Release Engineering - 1.3.9-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild