From 7b369318ddcf828c3526a1c64d029e03412c1a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 26 May 2022 10:02:10 +0000 Subject: [PATCH] zipl: check for secure boot once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check for secure boot status only once when starting to create the bootmap. Closes: https://github.com/ibm-s390-linux/s390-tools/pull/133 Signed-off-by: Dan Horák Reviewed-by: Stefan Haberland Signed-off-by: Jan Höppner --- zipl/src/bootmap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zipl/src/bootmap.c b/zipl/src/bootmap.c index 657e10c1..27620c8d 100644 --- a/zipl/src/bootmap.c +++ b/zipl/src/bootmap.c @@ -40,6 +40,9 @@ /* Pointer to dedicated empty block in bootmap. */ static disk_blockptr_t empty_block; +/* State of secure boot in the system */ +static bool secure_boot_supported; + /* Get size of a bootmap block pointer for disk with given INFO. */ static int get_blockptr_size(struct disk_info* info) @@ -519,7 +522,6 @@ static int add_ipl_program(int fd, char *filename, struct component_loc comp_loc[10]; struct signature_header sig_head; size_t ramdisk_size, image_size; - bool secure_boot_supported; size_t stage3_params_size; const char *comp_name[11]; size_t signature_size; @@ -608,7 +610,6 @@ static int add_ipl_program(int fd, char *filename, return -1; } image_size = stats.st_size; - secure_boot_supported = check_secure_boot_support(); signature_size = extract_signature(ZIPL_STAGE3_PATH, &signature, &sig_head); if (signature_size && @@ -1330,6 +1331,8 @@ bootmap_create_device(struct job_data *job, disk_blockptr_t *program_table, ulong unused_size; int fd; + secure_boot_supported = check_secure_boot_support(); + /* Get full path of bootmap file */ if (!dry_run) { filename = misc_strdup(job->data.dump.device);