diff --git a/s390utils-2.27.0-rhel.patch b/s390utils-2.27.0-rhel.patch index d73d4ec..2f3de56 100644 --- a/s390utils-2.27.0-rhel.patch +++ b/s390utils-2.27.0-rhel.patch @@ -1,7 +1,8 @@ -From 493af760ed47454f5719f05a6e6316f43a3be98a Mon Sep 17 00:00:00 2001 +From 368c5581b8e7f9f796764c3f697babd63d637767 Mon Sep 17 00:00:00 2001 From: Stefan Haberland Date: Mon, 8 May 2023 14:52:54 +0200 -Subject: [PATCH] zdev: add support for autoquiesce related sysfs attributes +Subject: [PATCH 1/4] zdev: add support for autoquiesce related sysfs + attributes (#2196517) Autoquiesce is a mechanism that tells Linux to stop issuing I/Os to a specific DASD after certain events. @@ -16,6 +17,7 @@ aq_timeouts - Configure the number of timeouts before autoquiesce. Signed-off-by: Stefan Haberland Reviewed-by: Peter Oberparleiter Signed-off-by: Steffen Eiden +(cherry picked from commit 493af760ed47454f5719f05a6e6316f43a3be98a) --- zdev/src/dasd.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) @@ -104,5 +106,191 @@ index f9fd231..4330229 100644 ), .unknown_dev_attribs = 1, -- -2.39.2 +2.40.1 + + +From 21a9e00ffeb5ef885ad52b73f2724cef6d1ae73d Mon Sep 17 00:00:00 2001 +From: Vineeth Vijayan +Date: Wed, 7 Jun 2023 14:10:56 +0200 +Subject: [PATCH 2/4] zdev: add proper value input for the ZDEV_SITE_ID key + (#2223304) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +udev does not allow an empty value for keys when importing output +from an external program. Providing an empty value for any key +invokes a warning during the parsing. Currently, ZDEV_SITE_ID for +fallback sites are not assigned any value. Add an empty double +quotes as the value in case of failover sites. + +This modification is tested on udevadm version 253 on fedora38. + +Also verify that the ZDEV_SITE_ID is properly written, if not log +the error. + +Fixes: c8ad5f57d0fc ("zdev: modify zdev_id to read the site_id from loadparm") +Reported-by: Alexander Egorenkov +Signed-off-by: Vineeth Vijayan +Reviewed-by: Peter Oberparleiter +Signed-off-by: Jan Höppner +(cherry picked from commit 27902c91064f5900fa0ae8116d3e1d0bcd9477bc) +--- + zdev/src/zdev_id.c | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +diff --git a/zdev/src/zdev_id.c b/zdev/src/zdev_id.c +index c341d31..9ad9961 100644 +--- a/zdev/src/zdev_id.c ++++ b/zdev/src/zdev_id.c +@@ -213,16 +213,28 @@ out: + static void write_zdev_site_id(int site_id) + { + FILE *fd; ++ int rc; + + fd = fopen(ZDEV_SITE_ID_FILE, "w"); + if (!fd) +- err(1, "Could not write to zdev_site_id file"); ++ goto err; ++ + if (site_id == SITE_FALLBACK) +- fprintf(fd, "ZDEV_SITE_ID=\n"); ++ rc = fprintf(fd, "ZDEV_SITE_ID=\"\"\n"); + else +- fprintf(fd, "ZDEV_SITE_ID=%d\n", site_id); ++ rc = fprintf(fd, "ZDEV_SITE_ID=%d\n", site_id); + +- fclose(fd); ++ if (rc < 0) { ++ fclose(fd); ++ goto err; ++ } ++ ++ if (fclose(fd)) ++ goto err; ++ ++ return; ++err: ++ err(1, "Could not write to zdev_site_id file"); + } + + /* Read the loadparm and extract the current site_id. +@@ -265,7 +277,7 @@ static void process_loadparm(const char *filename) + out: + write_zdev_site_id(site_id); + if (site_id == SITE_FALLBACK) +- printf("ZDEV_SITE_ID=\n"); ++ printf("ZDEV_SITE_ID=\"\"\n"); + else + printf("ZDEV_SITE_ID=%d\n", site_id); + } +-- +2.40.1 + + +From 90bab830c617cbecdc51ef9f6f2a19d14e6445c5 Mon Sep 17 00:00:00 2001 +From: Vineeth Vijayan +Date: Wed, 7 Jun 2023 14:10:57 +0200 +Subject: [PATCH 3/4] zdev: use rename-file to avoid any symlinks created + (#2223304) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +During the boot, the ZDEV_SITE_ID is derived with the help +of loadparm and will be saved in ZDEV_SITE_ID_FILE, which +will be the used by the udev-rules. + +ZDEV_SITE_ID_FILE creation can have a surface of symlink attack +as we are directly using the fopen and fprintf on it. To avoid +this, make sure that we are writing the ZDEV_SITE_ID to a temporary +file, which will then be renamed to ZDEV_SITE_ID_FILE, which will +remove all the existing symlinks associated with the target file. + +Reported-by: Marc Hartmayer +Signed-off-by: Vineeth Vijayan +Reviewed-by: Peter Oberparleiter +Signed-off-by: Jan Höppner +(cherry picked from commit 09c01e580abc519976c8e20c5d867b3d1a31e062) +--- + zdev/src/zdev_id.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/zdev/src/zdev_id.c b/zdev/src/zdev_id.c +index 9ad9961..2464b16 100644 +--- a/zdev/src/zdev_id.c ++++ b/zdev/src/zdev_id.c +@@ -213,9 +213,16 @@ out: + static void write_zdev_site_id(int site_id) + { + FILE *fd; +- int rc; ++ int tmpfd, rc; ++ const char zdev_id_file[] = ZDEV_SITE_ID_FILE; ++ char zdev_id_tmpfile[] = ZDEV_SITE_ID_FILE "-XXXXXX"; + +- fd = fopen(ZDEV_SITE_ID_FILE, "w"); ++ tmpfd = mkstemp(zdev_id_tmpfile); ++ if (tmpfd == -1) ++ goto err; ++ ++ /* Open the temp file to use with fprintf */ ++ fd = fdopen(tmpfd, "w"); + if (!fd) + goto err; + +@@ -232,6 +239,12 @@ static void write_zdev_site_id(int site_id) + if (fclose(fd)) + goto err; + ++ /* Rename the temporary file to ZDEV_SITE_ID_FILE*/ ++ if (rename(zdev_id_tmpfile, zdev_id_file) == -1) { ++ remove(zdev_id_tmpfile); ++ goto err; ++ } ++ + return; + err: + err(1, "Could not write to zdev_site_id file"); +-- +2.40.1 + + +From 5e9a117d1da306ad13b46612b709d769c792baae Mon Sep 17 00:00:00 2001 +From: Vineeth Vijayan +Date: Mon, 19 Jun 2023 11:32:15 +0200 +Subject: [PATCH 4/4] zdev: add missing label in the udev-rules (#2222900) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The udev-rules generated with the current version of chzdev command +is missing the configuration label, incase of auto configuration, +resulting in an ineffective configuration logic. +Add the missing configuration start label for autoconfig. + +Fixes: 2e89722ef0ec ("zdev: make site specific udev-rule for ccw") +Signed-off-by: Vineeth Vijayan +Reviewed-by: Peter Oberparleiter +Signed-off-by: Jan Höppner +(cherry picked from commit 2a1a821bb3941ddd341b52068d5c05e06d907355) +--- + zdev/src/udev_ccw.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/zdev/src/udev_ccw.c b/zdev/src/udev_ccw.c +index 3375a5e..1881337 100644 +--- a/zdev/src/udev_ccw.c ++++ b/zdev/src/udev_ccw.c +@@ -295,6 +295,7 @@ static exit_code_t udev_ccw_write_device_legacy(struct device *dev, bool autocon + } + fprintf(fd, "GOTO=\"%s\"\n", end_label); + fprintf(fd, "\n"); ++ fprintf(fd, "LABEL=\"%s\"\n", cfg_label); + + write_attr_to_file(fd, state, id); + +-- +2.40.1 diff --git a/s390utils.spec b/s390utils.spec index 66c2aa4..5206c6f 100644 --- a/s390utils.spec +++ b/s390utils.spec @@ -10,7 +10,7 @@ Name: s390utils Summary: Utilities and daemons for IBM z Systems Version: 2.27.0 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 2 License: MIT ExclusiveArch: s390 s390x @@ -898,6 +898,11 @@ User-space development files for the s390/s390x architecture. %changelog +* Mon Jul 17 2023 Dan Horák - 2:2.27.0-2 +- zdev: cleanup patches to fix warnings (#2223304) +- zdev: add missing label in the udev-rules (#2222900) +- Resolves: #2223304 #2222900 + * Wed May 31 2023 Dan Horák - 2:2.27.0-1 - rebased to 2.27.0 (#2160062) - lszcrypt fails when querying a specific domain (#2177612)