import s390utils-2.6.0-25.el8

This commit is contained in:
CentOS Sources 2020-01-21 18:20:39 -05:00 committed by Stepan Oksanichenko
parent a8b31d7218
commit cc17fcc87f
8 changed files with 14140 additions and 195 deletions

View File

@ -1,5 +1,9 @@
#!/bin/bash
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
exit 0
fi
[[ -f /etc/sysconfig/kernel ]] && . /etc/sysconfig/kernel
COMMAND="$1"
@ -70,7 +74,7 @@ case "$COMMAND" in
fi
fi
if [[ ! -f /sbin/new-kernel-pkg ]]; then
if [[ ! -f /sbin/new-kernel-pkg || -d "${BLS_DIR}" ]]; then
declare -a BOOT_OPTIONS
if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
@ -79,7 +83,7 @@ case "$COMMAND" in
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ "${i#initrd=*}" != "$i" ]] && continue
[[ "${i#initrd=*}" != "$i" || "${i#BOOT_IMAGE=*}" != "$i" ]] && continue
BOOT_OPTIONS+=("$i")
done
fi
@ -142,7 +146,7 @@ case "$COMMAND" in
exit 77
;;
remove)
if [[ ! -f /sbin/new-kernel-pkg ]]; then
if [[ ! -f /sbin/new-kernel-pkg || -d "${BLS_DIR}" ]]; then
ARCH="$(uname -m)"
BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf"
BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")"

View File

@ -15,7 +15,7 @@ BLS_DIR="/boot/loader/entries"
[[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}"
case "$COMMAND" in
add)
if [[ ! -f /sbin/new-kernel-pkg ]]; then
if [[ ! -f /sbin/new-kernel-pkg || -d "${BLS_DIR}" ]]; then
declare -a BOOT_OPTIONS
if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,146 @@
From ecf5a4ecb909bfd91306678d0c460ab2f2837a33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 18 Nov 2019 04:10:06 -0500
Subject: [PATCH 1/3] zipl: drop redundant string duplication
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Dan Horák <dan@danny.cz>
---
zipl/src/scan.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index 38fa5454..0ea37efa 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -1575,7 +1575,6 @@ scan_check_bls(struct scan_token *scan)
int i, rc;
char *target_value = NULL;
char *img_value = NULL;
- char *buffer = NULL;
/*
* In the BLS case, each BLS section heading inherits a keyword
* assignment target= from zipl.conf, and they are all the same.
@@ -1609,14 +1608,8 @@ scan_check_bls(struct scan_token *scan)
scan[i].content.keyword.value);
return rc;
}
- buffer = (char *)
- misc_malloc(strlen(img_value) + 1);
- if (buffer == NULL)
- return -1;
- memcpy(buffer, img_value, strlen(img_value));
- buffer[strlen(img_value)] = 0;
free(scan[i].content.keyword.value);
- scan[i].content.keyword.value = buffer;
+ scan[i].content.keyword.value = img_value;
}
}
}
From 05f83569960e2774e819fe0942da1f92d0cce35b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 18 Nov 2019 04:29:04 -0500
Subject: [PATCH 2/3] zipl: set reason not text for failed check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Dan Horák <dan@danny.cz>
---
zipl/src/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index 0ea37efa..0f01cac9 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -1603,7 +1603,7 @@ scan_check_bls(struct scan_token *scan)
scan[i].content.keyword.value);
rc = misc_check_readable_file(img_value);
if (rc) {
- error_text(
+ error_reason(
"Image file '%s' is not accessible",
scan[i].content.keyword.value);
return rc;
From 8ab552b430f109d80966d0c56bed0d204d917d30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 18 Nov 2019 11:45:50 -0500
Subject: [PATCH 3/3] zipl: fix handling of values with load address in BLS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Various keywords (like image or ramdisk) allow specifying a load address
as an optional argument. Adapt the logic for checking the presence of
the files to take this into the account.
Fixes: https://github.com/ibm-s390-tools/s390-tools/commit/d71628326d80e623fc9f008fe4ea93edb5592b2e
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1772054
Signed-off-by: Dan Horák <dan@danny.cz>
---
zipl/src/scan.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index 0f01cac9..a34edf62 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -1575,6 +1575,8 @@ scan_check_bls(struct scan_token *scan)
int i, rc;
char *target_value = NULL;
char *img_value = NULL;
+ char *file = NULL;
+ char *tmp, *value;
/*
* In the BLS case, each BLS section heading inherits a keyword
* assignment target= from zipl.conf, and they are all the same.
@@ -1595,19 +1597,37 @@ scan_check_bls(struct scan_token *scan)
if (scan[i].content.keyword.keyword == scan_keyword_image ||
scan[i].content.keyword.keyword == scan_keyword_ramdisk) {
- rc = misc_check_readable_file(
- scan[i].content.keyword.value);
+ value = scan[i].content.keyword.value;
+ /*
+ * put the filename only into the file var before
+ * checking its presence
+ */
+ if (contains_address(value)) {
+ tmp = strrchr(value, ',');
+ file = strndup(value, tmp - value);
+ } else {
+ file = value;
+ }
+ rc = misc_check_readable_file(file);
if (rc) {
misc_asprintf(&img_value, "%s%s",
- target_value,
- scan[i].content.keyword.value);
+ target_value, file);
rc = misc_check_readable_file(img_value);
if (rc) {
error_reason(
- "Image file '%s' is not accessible",
- scan[i].content.keyword.value);
+ "File '%s' not accessible", file);
return rc;
}
+ /*
+ * when file has stripped the load address part,
+ * do generate a prefixed value
+ */
+ if (file != value) {
+ free(file);
+ free(img_value);
+ misc_asprintf(&img_value, "%s%s",
+ target_value, value);
+ }
free(scan[i].content.keyword.value);
scan[i].content.keyword.value = img_value;
}

View File

@ -1,106 +0,0 @@
From 0318dfbc726a82ce1e9309e55186f3c4faae72f1 Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@sandeen.net>
Date: Wed, 12 Sep 2018 09:40:22 -0500
Subject: [PATCH] zipl: use FIEMAP mapping ioctl if it exists
zipl currently uses the FIBMAP ioctl to map blocks for the bootloader;
on XFS, if FIBMAP is requested on a reflinked file, it will fail -
and FIBMAP returns 0 in this case, which is indistinguishable from a
hole. This causes boot to fail because the file is not mapped.
We can use the FIEMAP ioctl instead, which is able to map reflinked
files. While FIEMAP is able to map entire extents at once, here we
simply use it to obtain the mapping block-by-block so that it fits
in with the current FIBMAP calls.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
zipl/src/disk.c | 57 +++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 53 insertions(+), 4 deletions(-)
diff --git a/zipl/src/disk.c b/zipl/src/disk.c
index 0d8e7796..43092bf1 100644
--- a/zipl/src/disk.c
+++ b/zipl/src/disk.c
@@ -21,6 +21,8 @@
#include <sys/sysmacros.h>
#include <sys/vfs.h>
#include <unistd.h>
+#include <linux/fs.h>
+#include <linux/fiemap.h>
#include "lib/util_proc.h"
@@ -550,8 +552,12 @@ disk_get_blocknum(int fd, int fd_is_basedisk, blocknum_t logical,
{
struct statfs buf;
blocknum_t phy_per_fs;
- int mapped;
+ blocknum_t mapped;
+ int block;
int subblock;
+ int fiemap_size;
+ int map_offset;
+ struct fiemap *fiemap;
/* No file system: partition or raw disk */
if (info->fs_block_size == -1) {
@@ -576,12 +582,55 @@ disk_get_blocknum(int fd, int fd_is_basedisk, blocknum_t logical,
}
/* Get mapping in file system blocks */
phy_per_fs = info->fs_block_size / info->phy_block_size;
- mapped = logical / phy_per_fs;
subblock = logical % phy_per_fs;
- if (ioctl(fd, FIBMAP, &mapped)) {
- error_reason("Could not get file mapping");
+
+ /* First try FIEMAP, more complicated to set up */
+ fiemap_size = sizeof(struct fiemap) + sizeof(struct fiemap_extent);
+
+ fiemap = misc_malloc(fiemap_size);
+ if (!fiemap)
return -1;
+ memset(fiemap, 0, fiemap_size);
+
+ fiemap->fm_extent_count = 1;
+ fiemap->fm_flags = FIEMAP_FLAG_SYNC;
+ /* fm_start, fm_length in bytes; logical is in physical block units */
+ fiemap->fm_start = logical * info->phy_block_size;
+ fiemap->fm_length = info->phy_block_size;
+
+ if (ioctl(fd, FS_IOC_FIEMAP, (unsigned long)fiemap)) {
+ /* FIEMAP failed, fall back to FIBMAP */
+ block = logical / phy_per_fs;
+ if (ioctl(fd, FIBMAP, &block)) {
+ error_reason("Could not get file mapping");
+ free(fiemap);
+ return -1;
+ }
+ mapped = block;
+ } else {
+ if (fiemap->fm_mapped_extents) {
+ if (fiemap->fm_extents[0].fe_flags &
+ FIEMAP_EXTENT_ENCODED) {
+ error_reason("File mapping is encoded");
+ free(fiemap);
+ return -1;
+ }
+ /*
+ * returned extent may start prior to our request
+ */
+ map_offset = fiemap->fm_start -
+ fiemap->fm_extents[0].fe_logical;
+ mapped = fiemap->fm_extents[0].fe_physical +
+ map_offset;
+ /* set mapped to fs block units */
+ mapped = mapped / info->fs_block_size;
+ } else {
+ mapped = 0;
+ }
}
+
+ free(fiemap);
+
if (mapped == 0) {
/* This is a hole in the file */
*physical = 0;

View File

@ -133,13 +133,12 @@ diff --git a/zipl/src/Makefile b/zipl/src/Makefile
index 1634c0d5121..bc797990652 100644
--- a/zipl/src/Makefile
+++ b/zipl/src/Makefile
@@ -11,7 +11,8 @@ ALL_CPPFLAGS += -I../include -I../boot \
@@ -7,7 +7,7 @@ ALL_CPPFLAGS += -I../include -I../boot \
-D_FILE_OFFSET_BITS=64 $(NO_PIE_CFLAGS)
ALL_LDFLAGS += -Wl,-z,noexecstack $(NO_PIE_LDFLAGS)
libs = $(rootdir)/libutil/libutil.a \
- $(rootdir)/libu2s/libu2s.a
+ $(rootdir)/libu2s/libu2s.a \
+ -lrpm
-libs = $(rootdir)/libutil/libutil.a
+libs = $(rootdir)/libutil/libutil.a -lrpm
objects = misc.o error.o scan.o job.o boot.o bootmap.o disk.o \
install.o zipl.o $(rootdir)/zipl/boot/data.o

View File

@ -1,50 +0,0 @@
From ce171812a829d6e0fe1c7d1f91d2ddd301f03bec Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 6 Nov 2018 13:29:32 +0100
Subject: [PATCH] zipl: use the BLS "title" field as the IPL section name
Most bootloaders use the BootLoaderSpec "title" field to name the entries
in their boot menu. The zipl bootloader used the "version" field instead,
since it was wrongly assumed that the zipl boot menu didn't support names
that contained spaces, which are usually present in a BLS "title" field.
But this is not the case, names with space characters are supported by the
IPL and is just a constraint of the section heading in the zipl.conf file.
So to be consistent with all the other bootloaders, use the "title" field
also on zipl when populating the boot menu entries from BLS files.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
scripts/zipl-switch-to-blscfg | 1 +
zipl/src/scan.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/zipl-switch-to-blscfg b/scripts/zipl-switch-to-blscfg
index 5272033e9848..5141b1c0dd6d 100755
--- a/scripts/zipl-switch-to-blscfg
+++ b/scripts/zipl-switch-to-blscfg
@@ -150,6 +150,7 @@ while IFS='= ' read key val; do
if [ -f "${OUTPUT}" ]; then
print_error "BLS file ${OUTPUT} already exists"
fi
+ echo "title $section" >> ${OUTPUT}
fi
elif [[ $val ]]; then
val="$(echo $val | sed -e 's/^[ \t"]*//;s/[ \t"]*$//')"
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index fe72e9ab13df..9160d083e5cb 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -701,7 +701,7 @@ scan_bls_field(struct misc_file_buffer *file, struct scan_token* scan,
file->buffer[key_end] = '\0';
file->buffer[val_end] = '\0';
- if (strncmp("version", &file->buffer[key_start], key_end - key_start) == 0) {
+ if (strncmp("title", &file->buffer[key_start], key_end - key_start) == 0) {
scan_append_section_heading(scan, index, &file->buffer[val_start]);
}
--
2.19.1

View File

@ -1,11 +1,15 @@
%define cmsfsver 1.1.8c
%define vipaver 2.1.0
%if 0%{?rhel} >= 8
%global signzipl 1
%endif
Name: s390utils
Summary: Utilities and daemons for IBM z Systems
Group: System Environment/Base
Version: 2.6.0
Release: 15%{?dist}
Release: 25%{?dist}
Epoch: 2
License: MIT
ExclusiveArch: s390 s390x
@ -30,17 +34,20 @@ Source23: 20-zipl-kernel.install
Source24: 52-zipl-rescue.install
Source25: 91-zipl.install
# for secure boot
%if 0%{?signzipl}
%define pesign_name redhatsecureboot302
%endif
# backported stuff for RHEL
Patch0: s390-tools-rhel.patch
# BLS support in zipl
# change the defaults to match Fedora environment
Patch100: s390-tools-zipl-invert-script-options.patch
# https://github.com/ibm-s390-tools/s390-tools/pull/36
Patch101: s390-tools-zipl-fiemap.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1640968
Patch102: s390-tools-zipl-sort-like-rpm.patch
# https://github.com/ibm-s390-tools/s390-tools/pull/47
Patch103: s390-tools-zipl-title-section-name.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1772054
Patch103: s390-tools-zipl-bls-loadaddr.patch
Patch1000: cmsfs-1.1.8-warnings.patch
Patch1001: cmsfs-1.1.8-kernel26.patch
@ -68,14 +75,13 @@ be used together with the zSeries (s390) Linux kernel and device drivers.
%prep
%setup -q -n s390-tools-%{version} -a 4 -a 6
# Backported suff for RHEL
# Backported stuff for RHEL
%patch0 -p1
# BLS support in zipl
%patch100 -p1 -b .zipl-invert-script-options
%patch101 -p1 -b .zipl-fiemap
%patch102 -p1 -b .zipl-sort-like-rpm
%patch103 -p1 -b .zipl-title-section-name
%patch103 -p1 -b .zipl-bls-loadaddr
#
# cmsfs
@ -132,6 +138,18 @@ make install \
DISTRELEASE=%{release} \
V=1
# sign the stage3 bootloader
%if 0%{?signzipl}
if [ -x /usr/bin/rpm-sign ]; then
pushd %{buildroot}/lib/s390-tools/
rpm-sign --key "%{pesign_name}" --lkmsign stage3.bin --output stage3.signed
mv stage3.signed stage3.bin
popd
else
echo "rpm-sign not available, stage3 won't be signed"
fi
%endif
mkdir -p $RPM_BUILD_ROOT{/boot,%{_udevrulesdir},%{_sysconfdir}/{profile.d,sysconfig},%{_prefix}/lib/modules-load.d}
install -p -m 644 zipl/boot/tape0.bin $RPM_BUILD_ROOT/boot/tape0
install -p -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_sbindir}
@ -839,7 +857,68 @@ User-space development files for the s390/s390x architecture.
%changelog
* Wed Feb 27 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-15
* Fri Dec 13 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-25
- kernel-install: skip BOOT_IMAGE param when copying the cmdline to BLS snippets (#1782321)
- Resolves: #1782321
* Wed Dec 11 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-24.1
- rebuild
* Tue Dec 10 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-24
- zipl: fix handling of values with load address in BLS (#1772054)
- kernel-install: fix /tmp being deleted when kernel-core is installed in a container (#1778771)
- kernel-install: fix BLS-related decision logic (#1778243)
- Resolves: #1772054 #1778771 #1778243
* Thu Nov 07 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-23
- zipl: config file handling improvements for CoreOS (#1764706)
- zipl: fix the scanned tokens array size calculation (#1751587)
- lstape, lsluns: handle non-zfcp; lin_tape multiple paths (#1766569)
- zcrypt: CEX7S exploitation support (#1723837)
- zkey: Add support for CCA AES CIPHER keys (#1719623)
- zkey: check master key consistency (#1753153)
- zkey: various enhancements (#1725881)
- zipl: set correct secure IPL default value (#1750326)
- zipl: Fix error message printed with --dumptofs (#1750307)
- zdev: add zfcp dix parameter handling (#1723852)
- zdsfs: add online vtoc refresh (#1685536)
- dasdfmt/lsdasd: Add Thin provisioning base support (#1651733)
- Resolves: #1651733 #1685536 #1723852 #1750307 #1750326 #1725881 #1753153
- Resolves: #1719623 #1723837 #1766569 #1751587 #1764706
* Thu Sep 26 2019 Javier Martinez Canillas <javierm@redhat.com> - 2:2.6.0-22
- force a BLS config if /boot/loader/entries directory exists (#1755899)
- Resolves: #1755899
* Thu Sep 12 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-21.1
- rebuild
* Wed Sep 04 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-21
- sign bootloader stage3 (#1739496)
- Resolves: #1739496
* Tue Aug 13 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-20
- zipl: fix zfcp dump image location (#1730707)
- Resolves: #1730707
* Wed Aug 07 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-19
- fdasd: Fix exit status in error cases (#1734816)
- zipl: do not overwrite BOOT_IMAGE entry (#1728677)
- Resolves: #1734816 #1728677
* Wed Jul 24 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-18
- zdev: Do not export inacceptable attribute values (#1731960)
- Resolves: #1731960
* Fri Jul 19 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-17
- ziomon: fix utilization recording with multi-digit scsi hosts (#1731203)
- Resolves: #1731203
* Thu Jul 18 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-16
- cpumf: Add support for CPU-Measurement Facility counters SVN 6 (#1683276)
- Resolves: #1683276
* Tue May 21 2019 Dan Horák <dhorak@redhat.com> - 2:2.6.0-15
- zpcictl: Check for regular directory (#1695001)
- s390-tools: Add zcryptstats tool (#1658756)
- zipl: Secure Boot support for SCSI IPL (#1659401)