zipl/src: Fix a bug in building replicated program tables

When installing IPL on mirrored targets, zipl builds multiple program
tables (one such table per each mirror). If the option "--add-files"
was specified, then zipl uses the in-bootmap files, that was written
at the prevoius iteration (for the mirror ID #0) to build program
tables for mirrors with ID #1 (and larger). The in-bootmap files
already don't contain trailers. Despite this, the building process
cuts off the tail of trailer size, which results in corrupted boot
data.

This bug may result in crashing the kernel when booting from mirrors
with ID #1 (and larger) and manifests only if the boot components are
signed and the option "--add-files" is specified for the installation
session.

Don't count the trailer, when building program tables using in-bootmap
files written at the previous iteration.

Fixes: 431e4542ca ("zipl/src: Reuse data of file components in bootmap")
Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Eduard Shishkin
2026-03-16 17:31:33 +01:00
committed by Jan Höppner
parent b401ad0da0
commit fcfee1aa84

View File

@@ -441,12 +441,14 @@ static int add_component_file(struct install_set *bis, const char *filename,
if (add_files && comp_reg->offset > 0) {
/*
* The file has been already written to the bootmap.
* The file has been already written to the bootmap,
* and that in-bootmap file doesn't contain a trailer.
* Use the respective region in the bootmap file to
* add the component
*/
filename = bis->filename;
add_files = 0;
trailer = 0;
} else {
comp_reg = NULL;
}