From f43789e16a6309eeebd946abb318a6523e33f963 Mon Sep 17 00:00:00 2001 From: Eduard Shishkin Date: Wed, 4 Sep 2024 10:20:13 +0200 Subject: [PATCH] zipl/src: fix bugs in SCSI dump installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes d6b702d57 which introduces a problem: SCSI dump installation fails: zipl -V -d /dev/mapper/mpathd1 Error: Invalid dump device: Could not read partition table The reasons: 1) Wrong (logical) device is passed as a target base; 2) In case of 'source_script' the check to make sure that specified target is over a partition isn't applicable any more after zipl support of complex logical targets (e.g. mirrors). The fixup passes the physical device as a target base (instead of the logical one). Also the fixup removes invalid check from check_dump_device_late() and instead adds a more generic check to the helper script that data starts beyong the boot area. Reported-by: Alexander Egorenkov Signed-off-by: Eduard Shishkin Tested-by: Mikhail Zaslonko Signed-off-by: Jan Höppner --- zipl/src/bootmap.c | 19 ++++++++++++++----- zipl/src/zipl_helper.device-mapper.c | 5 +++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/zipl/src/bootmap.c b/zipl/src/bootmap.c index b2402f9b..55c29355 100644 --- a/zipl/src/bootmap.c +++ b/zipl/src/bootmap.c @@ -971,9 +971,18 @@ check_dump_device_late(char *partition, struct disk_info *target_info, return rc; } if ((job->is_ldipl_dump && info->type != disk_type_eckd_cdl) || - (!job->is_ldipl_dump && info->type != disk_type_scsi) || - info->partnum == 0) { - error_reason("Device '%s' is not a SCSI or DASD partition", + (!job->is_ldipl_dump && info->type != disk_type_scsi)) { + error_reason("Device '%s' is not of SCSI or DASD-CDL type", + partition); + disk_free_info(info); + return -1; + } + /* + * Check that data starts beyong the boot area on the base disk. + * In case of source_script the check is performed by the script + */ + if (target->source == source_auto && info->partnum == 0) { + error_reason("Device '%s' is not a partition", partition); disk_free_info(info); return -1; @@ -1489,7 +1498,7 @@ static int prepare_build_program_table_device(struct job_data *job, printf("Target device information\n"); disk_print_info(bis->info, job->target.source); } - if (misc_temp_dev(bis->info->device, 1, &bis->basetmp[0])) + if (misc_temp_dev(bis->info->basedisks[0], 1, &bis->basetmp[0])) return -1; if (check_dump_device(job, bis->info, bis->basetmp[0])) return -1; @@ -1710,7 +1719,7 @@ static int prepare_bootloader_ngdump(struct job_data *job, /* Retrieve target device information */ if (disk_get_info(job->data.dump.device, &job->target, &info)) return -1; - if (misc_temp_dev(info->device, 1, &bis->basetmp[0])) + if (misc_temp_dev(info->basedisks[0], 1, &bis->basetmp[0])) return -1; if (check_dump_device(job, info, bis->basetmp[0])) return -1; diff --git a/zipl/src/zipl_helper.device-mapper.c b/zipl/src/zipl_helper.device-mapper.c index 6f96eae9..aca52be1 100644 --- a/zipl/src/zipl_helper.device-mapper.c +++ b/zipl/src/zipl_helper.device-mapper.c @@ -1364,6 +1364,11 @@ static int dm_dev_to_zipl_params(struct ext_dev *dev, char *dir) return -1; if (complete_physical_device(&pd, &base_dev)) goto error; + if (pd.offset < pd.dc.bootsectors) { + ERR("Unsupported setup: data starts at boot area on (%u:%u)\n", + major(base_dev), minor(base_dev)); + return -1; + } base_dev_to_params(base_dev, &pd.dc, pd.offset); if (pd.mirror) {