Compare commits

...

No commits in common. "c8" and "c10s" have entirely different histories.
c8 ... c10s

34 changed files with 956 additions and 6262 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

13
.gitignore vendored
View File

@ -1,4 +1,9 @@
SOURCES/cmsfs-1.1.8c.tar.gz s390-tools-1.8.2.tar.bz2
SOURCES/s390-tools-2.29.0-rust-vendor.tar.xz cmsfs-1.1.8c.tar.gz
SOURCES/s390-tools-2.29.0.tar.gz lib-zfcp-hbaapi-2.0.tar.gz
SOURCES/src_vipa-2.1.0.tar.gz src_vipa-2.0.4.tar.gz
/lib-zfcp-hbaapi-2.1.tar.gz
/src_vipa-2.1.0.tar.gz
/s390-tools-*.tar.bz2
/s390-tools-*.tar.gz
/s390-tools-*-rust-vendor.tar.xz

View File

@ -54,21 +54,25 @@ EOF
case "$COMMAND" in case "$COMMAND" in
add) add)
if [[ "${KERNEL_DIR}" != "/boot" ]]; then if [[ "${KERNEL_DIR}" != "/boot" ]]; then
# rename to match the name used in the pseudo-BLS snippet above
cp --remove-destination --preserve=timestamps -T "${KERNEL_IMAGE}" "/boot/vmlinuz-${KERNEL_VERSION}"
command -v restorecon &>/dev/null && \
restorecon -R "/boot/vmlinuz-${KERNEL_VERSION}"
for i in \ for i in \
"$KERNEL_IMAGE" \
"$KERNEL_DIR"/System.map \ "$KERNEL_DIR"/System.map \
"$KERNEL_DIR"/config \ "$KERNEL_DIR"/config \
"$KERNEL_DIR"/zImage.stub "$KERNEL_DIR"/zImage.stub
do do
[[ -e "$i" ]] || continue [[ -e "$i" ]] || continue
cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}" cp --preserve=timestamps -T "$i" "/boot/${i##*/}-${KERNEL_VERSION}"
command -v restorecon &>/dev/null && \ command -v restorecon &>/dev/null && \
restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}" restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}"
done done
# hmac is .vmlinuz-<version>.hmac so needs a special treatment # hmac is .vmlinuz-<version>.hmac so needs a special treatment
i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac"
if [[ -e "$i" ]]; then if [[ -e "$i" ]]; then
cp -a "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" cp --preserve=timestamps "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac"
command -v restorecon &>/dev/null && \ command -v restorecon &>/dev/null && \
restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac"
fi fi
@ -88,16 +92,10 @@ case "$COMMAND" in
done done
fi fi
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
echo "Could not determine the kernel command line parameters." >&2
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
exit 1
fi
[[ -d "$BLS_DIR" ]] || mkdir -m 0700 -p "$BLS_DIR" [[ -d "$BLS_DIR" ]] || mkdir -m 0700 -p "$BLS_DIR"
BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf"
if [[ -f "${KERNEL_DIR}/bls.conf" ]]; then if [[ -f "${KERNEL_DIR}/bls.conf" ]]; then
cp -aT "${KERNEL_DIR}/bls.conf" "${BLS_TARGET}" || exit $? cp --preserve=timestamps -T "${KERNEL_DIR}/bls.conf" "${BLS_TARGET}" || exit $?
sed -i -e "s,^linux.*,linux /boot/vmlinuz-${KERNEL_VERSION},g" "${BLS_TARGET}" sed -i -e "s,^linux.*,linux /boot/vmlinuz-${KERNEL_VERSION},g" "${BLS_TARGET}"
sed -i -e "s,^initrd.*,initrd /boot/initramfs-${KERNEL_VERSION}.img,g" "${BLS_TARGET}" sed -i -e "s,^initrd.*,initrd /boot/initramfs-${KERNEL_VERSION}.img,g" "${BLS_TARGET}"
sed -i -e "s#^options.*#options ${BOOT_OPTIONS[*]}#g" "${BLS_TARGET}" sed -i -e "s#^options.*#options ${BOOT_OPTIONS[*]}#g" "${BLS_TARGET}"
@ -118,7 +116,7 @@ case "$COMMAND" in
if [ "x${MAKEDEBUG}" = "xyes" ]; then if [ "x${MAKEDEBUG}" = "xyes" ]; then
BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")"
cp -aT "${BLS_TARGET}" "${BLS_DEBUG}" cp --preserve=timestamps -T "${BLS_TARGET}" "${BLS_DEBUG}"
TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')" TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')"
VERSION="$(grep '^version[ \t]' "${BLS_DEBUG}" | sed -e 's/^version[ \t]*//')" VERSION="$(grep '^version[ \t]' "${BLS_DEBUG}" | sed -e 's/^version[ \t]*//')"
BLSID="$(grep '^id[ \t]' "${BLS_DEBUG}" | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" BLSID="$(grep '^id[ \t]' "${BLS_DEBUG}" | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")"

View File

@ -29,12 +29,6 @@ case "$COMMAND" in
done done
fi fi
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
echo "Could not determine the kernel command line parameters." >&2
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
exit 1
fi
BLS_RESCUE="${BLS_DIR}/${MACHINE_ID}-0-rescue.conf" BLS_RESCUE="${BLS_DIR}/${MACHINE_ID}-0-rescue.conf"
if [[ -f "${BLS_RESCUE}" ]] && grep -q '^options.*$kernelopts' "${BLS_RESCUE}"; then if [[ -f "${BLS_RESCUE}" ]] && grep -q '^options.*$kernelopts' "${BLS_RESCUE}"; then
sed -i -e "s,^linux.*,linux /boot/vmlinuz-0-rescue-${MACHINE_ID},g" "${BLS_RESCUE}" sed -i -e "s,^linux.*,linux /boot/vmlinuz-0-rescue-${MACHINE_ID},g" "${BLS_RESCUE}"

View File

@ -1,9 +0,0 @@
#!/bin/bash
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
# Remove it, since for zipl the images are always installed in /boot
rm -rf "${BOOT_DIR_ABS%/*}"

View File

@ -1,13 +0,0 @@
ACTION!="add|change", GOTO="ccw_end"
SUBSYSTEM!="ccw", GOTO="ccw_end"
ATTRS{cutype}=="1731/01", RUN+="ccw_init"
ATTRS{cutype}=="1731/02", RUN+="ccw_init"
ATTRS{cutype}=="1731/05", RUN+="ccw_init"
ATTRS{cutype}=="1731/06", RUN+="ccw_init"
ATTRS{cutype}=="3088/01", RUN+="ccw_init"
ATTRS{cutype}=="3088/08", RUN+="ccw_init"
ATTRS{cutype}=="3088/60", RUN+="ccw_init"
ATTRS{cutype}=="3088/61", RUN+="ccw_init"
ATTRS{cutype}=="3088/1e", RUN+="ccw_init"
ATTRS{cutype}=="3088/1f", RUN+="ccw_init"
LABEL="ccw_end"

View File

@ -1,12 +0,0 @@
diff -up cmsfs-1.1.8c/cmsfslst.c.orig cmsfs-1.1.8c/cmsfslst.c
--- cmsfs-1.1.8c/cmsfslst.c.orig 2020-08-19 09:47:36.459063820 +0000
+++ cmsfs-1.1.8c/cmsfslst.c 2020-08-19 09:47:45.619063820 +0000
@@ -49,7 +49,7 @@ int main(int argc,unsigned char *argv[])
}
/* sanity check */
- if (*devname == 0x00)
+ if ((devname == NULL) || (*devname == 0x00))
{
(void) fprintf(stderr,"Please specify a CMS volume.\n");
(void) fprintf(stderr,USAGE,argv[0]);

View File

@ -1,12 +0,0 @@
diff -aruN cmsfs-1.1.8c/cmsfssed.sh cmsfs-1.1.8c.alma/cmsfssed.sh
--- cmsfs-1.1.8c/cmsfssed.sh 2006-01-29 07:04:32
+++ cmsfs-1.1.8c.alma/cmsfssed.sh 2023-11-01 10:57:10
@@ -85,7 +85,7 @@
DRIVER_SOURCE="cmsfs22x.c"
MODULES_DIRECTORY="/lib/modules/`uname -r`/fs"
;;
- 2.4*|2.5*)
+ 2.4*|2.5*|2.6*|3.*|4.*|5.*)
LINUX_RELEASE="2.4"
# ln -s cmsfs24x.c cmsfsvfs.c
INCLUDES="-I/lib/modules/`uname -r`/build/include"

View File

@ -1,31 +0,0 @@
From 25442f958a12b428b7d063b927ac48965dcd8164 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Fri, 28 Jan 2011 16:11:19 +0100
Subject: [PATCH] use detected filesystem block size on FBA devices
If a FBA device is not properly formated, then the CMS file system can
have a different block size. The cmsfs tools were able to detect the file
system block size, but in fact they still used default 512 instead. And
using the default was causing crashes. Now the detected value is used.
https://bugzilla.redhat.com/show_bug.cgi?id=651012
---
cmsfsany.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cmsfsany.c b/cmsfsany.c
index 55bcfdc..18efffb 100644
--- a/cmsfsany.c
+++ b/cmsfsany.c
@@ -102,7 +102,7 @@ int cmsfs_find_label(struct CMSSUPER *vol,struct CMSFSADT *adt)
cmsfs_error(cmsfs_ermsg);
}
vol->flags = CMSFSFBA;
- vol->blksz = 512;
+ vol->blksz = blksz;
return vol->blksz;
} }
--
1.7.3.5

View File

@ -1,11 +0,0 @@
--- cmsfs-1.1.8/cmsfsvol.c.warnings 2003-07-18 01:38:57.000000000 +0200
+++ cmsfs-1.1.8/cmsfsvol.c 2005-09-06 16:57:15.000000000 +0200
@@ -52,7 +52,7 @@
/* print a header; looks like CMS */
(void) printf("LABEL VDEV M STAT CYL TYPE \
-BLKSZ FILES BLKS USED-(%) BLKS LEFT BLK TOTAL\n");
+BLKSZ FILES BLKS USED-(%%) BLKS LEFT BLK TOTAL\n");
for ( ; i < argc ; i++)
{

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
diff -up s390-tools-2.2.0/src_vipa-2.1.0/Makefile.orig s390-tools-2.2.0/src_vipa-2.1.0/Makefile
--- s390-tools-2.2.0/src_vipa-2.1.0/Makefile.orig 2020-02-21 13:51:23.502305796 +0100
+++ s390-tools-2.2.0/src_vipa-2.1.0/Makefile 2020-02-21 13:53:51.353817181 +0100
@@ -44,6 +44,8 @@ src_vipa.sh:
echo '#!/bin/bash' > src_vipa.sh
echo 'export LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH' >> src_vipa.sh
echo 'export LD_PRELOAD=$(LIBDIR)/src_vipa.so' >> src_vipa.sh
+ echo 'echo "WARNING: The src_vipa (flexible source address selection) feature is DEPRECATED"' >> src_vipa.sh
+ echo 'echo "WARNING: It will be removed in the future."' >> src_vipa.sh
echo 'exec $$@' >> src_vipa.sh
chmod 755 src_vipa.sh

4
ccw.udev Normal file
View File

@ -0,0 +1,4 @@
ACTION!="add|bind|change", GOTO="ccw_end"
SUBSYSTEM!="ccw", GOTO="ccw_end"
DRIVER=="ctcm|lcs|qeth", RUN+="ccw_init"
LABEL="ccw_end"

View File

@ -7,7 +7,6 @@ Before=sysinit.target systemd-udev-trigger.service
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/usr/sbin/device_cio_free ExecStart=/usr/sbin/device_cio_free
StandardOutput=syslog
[Install] [Install]
WantedBy=sysinit.target WantedBy=sysinit.target

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.beaker-tier1.functional}

9
plans/gating.fmf Normal file
View File

@ -0,0 +1,9 @@
summary: Run s390utils gating tests
discover:
how: fmf
test:
- "^/tests/sanity"
execute:
how: tmt

4
plans/main.fmf Normal file
View File

@ -0,0 +1,4 @@
adjust:
- when: arch != s390x
enabled: false
because: The s390utils package is s390x only.

8
rpminspect.yaml Normal file
View File

@ -0,0 +1,8 @@
---
pathmigration:
excluded_paths:
- /lib/s390-tools
badfuncs:
ignore:
- /usr/sbin/qethqoat

311
s390utils-2.33.1-rhel.patch Normal file
View File

@ -0,0 +1,311 @@
From ab26b43985f44b71abf40f8d0e50bfbd0808f8b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20H=C3=B6ppner?= <hoeppner@linux.ibm.com>
Date: Fri, 14 Jun 2024 14:25:40 +0200
Subject: [PATCH 1/2] s390-tools: Replace 'which' with built-in 'command -v'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There are still a few scripts using the 'which' command to determine
either the full path or the mere existence of an executable.
Some of these scripts might run in minimal environments where 'which' is
not available due to dependency restriction. 'which' is also considered
unreliable for historical implementation details.
Use the POSIX defined [1] built-in 'command -v' instead to reduce
package dependencies and improve reliability.
[1] https://pubs.opengroup.org/onlinepubs/9699919799/
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
(cherry picked from commit 0b0960254e8c2b556cefa97f83651a92f54a5e42)
---
iucvterm/doc/ts-shell/iucvconn_on_login | 2 +-
netboot/mk-pxelinux-ramfs | 2 +-
ziomon/ziomon | 3 +--
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/iucvterm/doc/ts-shell/iucvconn_on_login b/iucvterm/doc/ts-shell/iucvconn_on_login
index 860c4cc..92010df 100755
--- a/iucvterm/doc/ts-shell/iucvconn_on_login
+++ b/iucvterm/doc/ts-shell/iucvconn_on_login
@@ -15,7 +15,7 @@
prog_name=`basename $0`
guest_name=${USER:-`whoami 2>/dev/null`}
terminal=lnxhvc0
-iucvconn=`which iucvconn 2>/dev/null`
+iucvconn=`command -v iucvconn 2>/dev/null`
__error() {
printf "$prog_name: $@\n" >&2
diff --git a/netboot/mk-pxelinux-ramfs b/netboot/mk-pxelinux-ramfs
index 64ebde1..07f8b07 100755
--- a/netboot/mk-pxelinux-ramfs
+++ b/netboot/mk-pxelinux-ramfs
@@ -127,7 +127,7 @@ echo "$cmd: Copying kexec"
# Install both binary and required shared libraries
OLDPATH=$PATH
PATH=$OLDPATH:/sbin:/usr/sbin
-kexec_bin=$(which kexec)
+kexec_bin=$(command -v kexec)
kexec_sos=$(sharedobjs $kexec_bin)
PATH=$OLDPATH
diff --git a/ziomon/ziomon b/ziomon/ziomon
index fd6248a..d1545cc 100755
--- a/ziomon/ziomon
+++ b/ziomon/ziomon
@@ -667,8 +667,7 @@ function check_free_space_mileage() {
function check_blktrace() {
- which blktrace >/dev/null 2>&1;
- if [ $? -ne 0 ]; then
+ if ! command -v blktrace >/dev/null 2>&1; then
echo "$WRP_TOOLNAME: Could not find blktrace. Please make sure that the blktrace package is installed and matches the level in the documentation.";
exit 1;
fi
--
2.45.2
From 9770d8bff4b2ef6f01af1c273d1eac121b672a85 Mon Sep 17 00:00:00 2001
From: Marc Hartmayer <mhartmay@linux.ibm.com>
Date: Thu, 6 Jun 2024 15:07:45 +0000
Subject: [PATCH 2/2] Revert "zipl/src: Fix problems when target parameters are
specified by user"
The commit fb0b6263d1a9 ("zipl/src: Fix problems when target parameters
are specified by user") breaks the case where the user has to provide
all target attributes via the zipl command line, because the target
device cannot be used to retrieve those attributes.
$ zipl -V --blsdir /tmp/tmp.xHmFUdgBCi/boot//loader/entries/ --config /tmp/tmp.dSv9MJ3svs
Looking for components in '/lib/s390-tools'
Using config file '/tmp/tmp.dSv9MJ3svs' (from command line)
Using BLS config file '/tmp/tmp.xHmFUdgBCi/boot//loader/entries//50_normal.conf'
Using BLS config file '/tmp/tmp.xHmFUdgBCi/boot//loader/entries//45_normal_swiotlb.conf'
Using BLS config file '/tmp/tmp.xHmFUdgBCi/boot//loader/entries//40_pv.conf'
Using BLS config file '/tmp/tmp.xHmFUdgBCi/boot//loader/entries//30_pv_reboot.conf'
Secure boot support: yes
Target device information
Device..........................: 2b:00
Device name.....................: nbd0 *)
Device driver name..............: nbd
Type............................: disk device
Disk layout.....................: SCSI disk layout *)
Geometry - start................: 2048 *)
File system block size..........: 4096
Physical block size.............: 512 *)
Device size in physical blocks..: 2095071
*) Data provided by user.
Building bootmap in '/tmp/tmp.xHmFUdgBCi/boot/'
Building menu 'zipl-automatic-menu'
Adding #1: IPL section 'Normal Guest' (default)
initial ramdisk...: /tmp/tmp.xHmFUdgBCi/boot//ramdisk-s390x
kernel image......: /tmp/tmp.xHmFUdgBCi/boot//vmlinux-s390x
zIPL environment block content:
Error: Could not add image file '/tmp/tmp.xHmFUdgBCi/boot//vmlinux-s390x': Could not get disk geometry
This reverts commit fb0b6263d1a9a497760a21ccb178748ec5ccf955.
Acked-by: Eduard Shishkin <edward6@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
(cherry picked from commit 63ff07ba38dda99e2661a097d05266555c727a2e)
---
zipl/include/job.h | 1 -
zipl/src/bootmap.c | 40 +++++++++++++++++++---------------------
zipl/src/disk.c | 3 ---
zipl/src/job.c | 3 ++-
4 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/zipl/include/job.h b/zipl/include/job.h
index e46788b..597d400 100644
--- a/zipl/include/job.h
+++ b/zipl/include/job.h
@@ -152,7 +152,6 @@ static inline int target_parameters_are_set(struct job_target_data *td)
int job_get(int argc, char* argv[], struct job_data** data);
void job_free(struct job_data* job);
-void free_target_data(struct job_target_data *td);
int type_from_target(char *target, disk_type_t *type);
int check_job_dump_images(struct job_dump_data* dump, char* name);
int check_job_images_ngdump(struct job_dump_data* dump, char* name);
diff --git a/zipl/src/bootmap.c b/zipl/src/bootmap.c
index 82b77d0..f6f5bac 100644
--- a/zipl/src/bootmap.c
+++ b/zipl/src/bootmap.c
@@ -304,6 +304,7 @@ static int add_component_file_range(struct install_set *bis,
address_t load_address,
size_t trailer, void *component,
int add_files,
+ struct job_target_data *target,
int comp_id, int menu_idx,
int program_table_id)
{
@@ -338,15 +339,8 @@ static int add_component_file_range(struct install_set *bis,
return -1;
}
} else {
- /*
- * Make sure that file is on target device.
- * For this, retrieve info of the underlying disk without
- * any user hints
- */
- struct job_target_data tmp = {.source = source_unknown};
-
- rc = disk_get_info_from_file(filename, &tmp, &file_info);
- free_target_data(&tmp);
+ /* Make sure file is on correct device */
+ rc = disk_get_info_from_file(filename, target, &file_info);
if (rc)
return -1;
if (file_info->device != bis->info->device) {
@@ -383,11 +377,12 @@ write_segment_table:
static int add_component_file(struct install_set *bis, const char *filename,
address_t load_address, size_t trailer,
void *component, int add_files,
- int comp_id, int menu_idx, int program_table_id)
+ struct job_target_data *target, int comp_id,
+ int menu_idx, int program_table_id)
{
return add_component_file_range(bis, filename, NULL, load_address,
trailer, component, add_files,
- comp_id, menu_idx,
+ target, comp_id, menu_idx,
program_table_id);
}
@@ -549,7 +544,8 @@ static int add_ipl_program(struct install_set *bis, char *filename,
bool add_envblk, struct job_envblk_data *envblk,
struct job_ipl_data *ipl, disk_blockptr_t *program,
int verbose, int add_files, component_header_type type,
- int is_secure, int menu_idx, int program_table_id)
+ struct job_target_data *target, int is_secure,
+ int menu_idx, int program_table_id)
{
struct signature_header sig_head;
size_t ramdisk_size, image_size;
@@ -671,7 +667,7 @@ static int add_ipl_program(struct install_set *bis, char *filename,
/* Add stage 3 loader to bootmap */
rc = add_component_file(bis, ZIPL_STAGE3_PATH, STAGE3_LOAD_ADDRESS,
signature_size, VOID_ADD(table, offset), 1,
- COMPONENT_ID_LOADER, menu_idx,
+ target, COMPONENT_ID_LOADER, menu_idx,
program_table_id);
if (rc) {
error_text("Could not add internal loader file '%s'",
@@ -749,7 +745,7 @@ static int add_ipl_program(struct install_set *bis, char *filename,
rc = add_component_file(bis, ipl->common.image, ipl->common.image_addr,
signature_size, VOID_ADD(table, offset),
- add_files, COMPONENT_ID_KERNEL_IMAGE,
+ add_files, target, COMPONENT_ID_KERNEL_IMAGE,
menu_idx, program_table_id);
if (rc) {
error_text("Could not add image file '%s'", ipl->common.image);
@@ -809,7 +805,7 @@ static int add_ipl_program(struct install_set *bis, char *filename,
ipl->common.ramdisk_addr,
signature_size,
VOID_ADD(table, offset),
- add_files, COMPONENT_ID_RAMDISK,
+ add_files, target, COMPONENT_ID_RAMDISK,
menu_idx, program_table_id);
if (rc) {
error_text("Could not add ramdisk '%s'",
@@ -865,7 +861,7 @@ static int add_ipl_program(struct install_set *bis, char *filename,
rc = add_component_file_range(bis, filename, &reg,
ipl->envblk_addr, 0,
VOID_ADD(table, offset),
- 0,
+ 0, target,
COMPONENT_ID_ENVBLK,
menu_idx,
program_table_id);
@@ -897,6 +893,7 @@ static int add_segment_program(struct install_set *bis,
struct job_segment_data *segment,
disk_blockptr_t *program, int verbose,
int add_files, component_header_type type,
+ struct job_target_data *target,
int program_table_id)
{
void *table;
@@ -916,7 +913,7 @@ static int add_segment_program(struct install_set *bis,
printf(" segment file......: %s\n", segment->segment);
rc = add_component_file(bis, segment->segment, segment->segment_addr, 0,
- VOID_ADD(table, offset), add_files,
+ VOID_ADD(table, offset), add_files, target,
COMPONENT_ID_SEGMENT_FILE, 0 /* menu_idx */,
program_table_id);
if (rc) {
@@ -999,7 +996,7 @@ static int add_dump_program(struct install_set *bis, struct job_data *job,
ipl.common.parmline = dump->common.parmline;
ipl.common.parm_addr = dump->common.parm_addr;
return add_ipl_program(bis, NULL, false, NULL, &ipl, program,
- verbose, 1, type, SECURE_BOOT_DISABLED,
+ verbose, 1, type, target, SECURE_BOOT_DISABLED,
0 /* menu_idx */, program_table_id);
}
@@ -1044,7 +1041,8 @@ static int build_program_table(struct job_data *job,
true, &job->envblk, &job->data.ipl,
&table[0], verbose || job->command_line,
job->add_files, component_header,
- job->is_secure, 0, program_table_id);
+ &job->target, job->is_secure, 0,
+ program_table_id);
break;
case job_segment:
if (bis->print_details) {
@@ -1057,7 +1055,7 @@ static int build_program_table(struct job_data *job,
rc = add_segment_program(bis, &job->data.segment, &table[0],
verbose || job->command_line,
job->add_files, COMPONENT_HEADER_IPL,
- program_table_id);
+ &job->target, program_table_id);
break;
case job_dump_partition:
/* Only useful for a partition dump that uses a dump kernel*/
@@ -1116,7 +1114,7 @@ static int build_program_table(struct job_data *job,
&table[job->data.menu.entry[i].pos],
verbose || job->command_line,
job->add_files, component_header,
- is_secure, i,
+ &job->target, is_secure, i,
program_table_id);
break;
case job_print_usage:
diff --git a/zipl/src/disk.c b/zipl/src/disk.c
index b4bd49a..38a637c 100644
--- a/zipl/src/disk.c
+++ b/zipl/src/disk.c
@@ -528,9 +528,6 @@ static int disk_set_info_complete(struct job_target_data *td,
* config file, or special "target options" of zipl tool.
* If target parameters were specified by user, then the step 1 above
* is skipped.
-
- * To exclude any user assumptions about the DEVICE, this function
- * should be called with TD pointing to a zeroed structure.
*
* DEVICE: logical, or physical device, optionally formated with a
* file system.
diff --git a/zipl/src/job.c b/zipl/src/job.c
index 2066402..27f0181 100644
--- a/zipl/src/job.c
+++ b/zipl/src/job.c
@@ -370,7 +370,8 @@ get_command_line(int argc, char* argv[], struct command_line* line)
}
-void free_target_data(struct job_target_data *data)
+static void
+free_target_data(struct job_target_data* data)
{
free(data->bootmap_dir);
free(data->targetbase);
--
2.45.2

File diff suppressed because it is too large Load Diff

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (s390-tools-2.33.1.tar.gz) = 8e5cba1e5264787a2f89b340d4d9372df7cd28ae9fa263dcbc6cbbf460e48c1db167110ff901f35f82e36d0d8c97105acd7167b40d889a829c71b182e175b96c
SHA512 (s390-tools-2.33.1-rust-vendor.tar.xz) = 12b0d3af1eba223b63028b5fec85ff4cc79ec646671e56d4c3606b0b4a9d3f79469dc860141ff86e9a0fd2bc1d54f32f2588615997a9865adbe20a110237b98d

View File

@ -0,0 +1,138 @@
#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
#
# extract-mod-sig <part> <module-file>
#
# Reads the module file and writes out some or all of the signature
# section to stdout. Part is the bit to be written and is one of:
#
# -0: The unsigned module, no signature data at all
# -a: All of the signature data, including magic number
# -d: Just the descriptor values as a sequence of numbers
# -n: Just the signer's name
# -k: Just the key ID
# -s: Just the crypto signature or PKCS#7 message
#
use warnings;
use strict;
die "Format: $0 -[0adnks] module-file >out\n"
if ($#ARGV != 1);
my $part = $ARGV[0];
my $modfile = $ARGV[1];
my $magic_number = "~Module signature appended~\n";
#
# Read the module contents
#
open FD, "<$modfile" || die $modfile;
binmode(FD);
my @st = stat(FD);
die "$modfile" unless (@st);
my $buf = "";
my $len = sysread(FD, $buf, $st[7]);
die "$modfile" unless (defined($len));
die "Short read on $modfile\n" unless ($len == $st[7]);
close(FD) || die $modfile;
print STDERR "Read ", $len, " bytes from module file\n";
die "The file is too short to have a sig magic number and descriptor\n"
if ($len < 12 + length($magic_number));
#
# Check for the magic number and extract the information block
#
my $p = $len - length($magic_number);
my $raw_magic = substr($buf, $p);
die "Magic number not found at $len\n"
if ($raw_magic ne $magic_number);
print STDERR "Found magic number at $len\n";
$p -= 12;
my $raw_info = substr($buf, $p, 12);
my @info = unpack("CCCCCxxxN", $raw_info);
my ($algo, $hash, $id_type, $name_len, $kid_len, $sig_len) = @info;
if ($id_type == 0) {
print STDERR "Found PGP key identifier\n";
} elsif ($id_type == 1) {
print STDERR "Found X.509 cert identifier\n";
} elsif ($id_type == 2) {
print STDERR "Found PKCS#7/CMS encapsulation\n";
} else {
print STDERR "Found unsupported identifier type $id_type\n";
}
#
# Extract the three pieces of info data
#
die "Insufficient name+kid+sig data in file\n"
unless ($p >= $name_len + $kid_len + $sig_len);
$p -= $sig_len;
my $raw_sig = substr($buf, $p, $sig_len);
$p -= $kid_len;
my $raw_kid = substr($buf, $p, $kid_len);
$p -= $name_len;
my $raw_name = substr($buf, $p, $name_len);
my $module_len = $p;
if ($sig_len > 0) {
print STDERR "Found $sig_len bytes of signature [";
my $n = $sig_len > 16 ? 16 : $sig_len;
foreach my $i (unpack("C" x $n, substr($raw_sig, 0, $n))) {
printf STDERR "%02x", $i;
}
print STDERR "]\n";
}
if ($kid_len > 0) {
print STDERR "Found $kid_len bytes of key identifier [";
my $n = $kid_len > 16 ? 16 : $kid_len;
foreach my $i (unpack("C" x $n, substr($raw_kid, 0, $n))) {
printf STDERR "%02x", $i;
}
print STDERR "]\n";
}
if ($name_len > 0) {
print STDERR "Found $name_len bytes of signer's name [$raw_name]\n";
}
#
# Produce the requested output
#
if ($part eq "-0") {
# The unsigned module, no signature data at all
binmode(STDOUT);
print substr($buf, 0, $module_len);
} elsif ($part eq "-a") {
# All of the signature data, including magic number
binmode(STDOUT);
print substr($buf, $module_len);
} elsif ($part eq "-d") {
# Just the descriptor values as a sequence of numbers
print join(" ", @info), "\n";
} elsif ($part eq "-n") {
# Just the signer's name
print STDERR "No signer's name for PKCS#7 message type sig\n"
if ($id_type == 2);
binmode(STDOUT);
print $raw_name;
} elsif ($part eq "-k") {
# Just the key identifier
print STDERR "No key ID for PKCS#7 message type sig\n"
if ($id_type == 2);
binmode(STDOUT);
print $raw_kid;
} elsif ($part eq "-s") {
# Just the crypto signature or PKCS#7 message
binmode(STDOUT);
print $raw_sig;
}

16
tests/sanity/main.fmf Normal file
View File

@ -0,0 +1,16 @@
summary: sanity
description: |
Basic test for s390utils
contact: Daniel Horak <dhorak@redhat.com>
component:
- s390utils
test: ./runtest.sh
framework: beakerlib
require:
- s390utils-base
duration: 5m
enabled: true
adjust:
- when: arch != s390x
enabled: false
because: This this package is s390x only

157
tests/sanity/runtest.sh Executable file
View File

@ -0,0 +1,157 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/s390utils/Sanity/smoke-functionality
# Description: Smoke, Sanity and function tests
# Author: Dan Horák <sharkcz@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="s390utils-base"
EXTRACT="$PWD/extract-module-sig.pl"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest "General tests"
rlRun "chccwdev --version"
rlRun "chchp --version"
rlRun "chcpumf --version"
rlRun "chreipl --version"
rlRun "chshut --version"
rlRun "chzcrypt --version"
rlRun "chzdev --version"
rlRun "cio_ignore --version"
rlRun "dasdfmt --version"
rlRun "dasdinfo --version"
rlRun "dasdstat --version"
rlRun "dasdview --version"
rlRun "fdasd --version"
rlRun "hyptop --version"
rlRun "lschp --version"
rlRun "lscpumf --version"
rlRun "lscss --version"
rlRun "lsdasd --version"
rlRun "lsqeth --version"
rlRun "lsluns --version"
rlRun "lsreipl --version"
rlRun "lsscm --version"
rlRun "lsshut --version"
rlRun "lstape --version"
rlRun "lszcrypt --version"
rlRun "lszdev --version"
rlRun "lszfcp --version"
rlRun "qetharp --version"
rlRun "qethconf --version"
rlRun "qethqoat --version"
rlRun "tape390_crypt --version"
rlRun "tape390_display --version"
rlRun "ttyrun --version"
rlRun "tunedasd --version"
rlRun "vmcp --version"
rlRun "vmur --version"
rlRun "zcryptctl --version"
rlRun "zcryptstats --version"
rlRun "zfcpdbf --version"
rlRun "zgetdump --version"
rlRun "zipl --version"
rlRun "znetconf --version"
rlRun "zpcictl --version"
rlRun "zkey --version"
rlRun "zkey-cryptsetup --version"
rlPhaseEnd
rlPhaseStartTest "s390utils 2.15.1+ - RHEL 8.4+ and RHEL 9"
rlRun "hsci --version"
rlRun "lsstp --version"
# check for perl-free s390utils-core
rlRun "rpm -q --requires s390utils-core | grep -q perl" 1 "Checking Perl deps in s390utils-core"
# check kernel installation, must not create /boot/<machineid>
if [ $UID -eq 0 ]; then
if rlCheckRpm kernel-core; then
rlRun "dnf -y reinstall kernel-core" 0 "Reinstalling the kernel to verify BLS scripts function"
rlAssertNotExists /boot/`cat /etc/machine-id`
else
rlLog "Skipping kernel reinstallation / BLS test, kernel-core not installed, probably running in a container"
fi
else
rlLog "Skipping kernel reinstallation / BLS test, needs root permissions"
fi
rlPhaseEnd
rlPhaseStartTest "s390utils 2.16.0+ - RHEL 8.5+ and RHEL 9"
rlRun "lshwc --version"
rlPhaseEnd
rlPhaseStartTest "s390utils 2.19.0+ - RHEL 8.6+ and RHEL 9"
rlRun "hsavmcore --version"
rlRun "sclpdbf --version"
rlRun "zipl-editenv --version"
rlPhaseEnd
rlPhaseStartTest "s390utils 2.22.0+ - RHEL 8.7+ and RHEL 9.1+"
rlRun "pai --version"
rlRun "pvattest --version"
rlRun "pvextract-hdr -h"
rlPhaseEnd
rlPhaseStartTest "s390utils 2.25.0+ - RHEL 8.8+ and RHEL 9.2+"
# no new tools
rlPhaseEnd
rlPhaseStartTest "s390utils 2.27.0+ - RHEL 8.9+ and RHEL 9.3+"
# no new tools
rlPhaseEnd
rlPhaseStartTest "s390utils 2.29.0+ - RHEL 8.10+ and RHEL 9.4+"
rlRun "pvsecret --version"
rlPhaseEnd
rlPhaseStartTest "s390utils 2.33.1+ - RHEL 9.5+ and RHEL 10"
rlRun "chpstat --version"
rlRun "lspai --version"
rlPhaseEnd
rlPhaseStartTest "Bootloader signature"
# only RHEL has signed bootloader
if rlIsRHEL '>=8'; then
rlRun "$EXTRACT -s /usr/lib/s390-tools/stage3.bin > stage3.bin.sig" 0 "Check bootloader signature"
else
rlLog "Skipping bootloader signature check, not on RHEL"
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd