bootstd: Bound file loads from boot media
cover bootstd: Bound file loads from boot media
Bootstd reads files from whatever boot media it finds, such as a USB stick or SD card, or from a TFTP server, and some of the sizes and offsets that decide where those files land in memory come from the media itself. This series checks them in four places where they are used as they are.
Patch 1: the pxe parser reads a file named by 'include' to the memory just after the config file that includes it. The extlinux and pxe bootmeths parse the config file from a heap buffer allocated to fit it, so the included file, of up to 1GB, is written past the end of that buffer. Refuse 'include' in a config file read by a bootmeth; the pxe and sysboot commands, which read the config file to ${pxefile_addr_r}, keep it.
Patch 2: the load command refuses to read a file over reserved memory, such as U-Boot itself, since the fix for CVE-2018-18440. The bootmeths and sysboot read files with fs_read(), which does not check this, so a large kernel, initrd or FDT can be written over U-Boot. sysboot had the check until it stopped using the load commands. Use the load command's checked read in both.
Patch 3: the ChromiumOS bootmeth takes the bootloader address and size from the kernel preamble without checking them against the kernel body. Check them, in the same way as the recent keyblock_size check. Its private data is now allocated zeroed, since the error path frees a buffer pointer in it which is only set once the read succeeds.
Patch 4: zimage_get_kernel_version() takes the offset of the version string from the setup header and reads as far as the nul terminator, without a limit on either. Give it the size of what it may read. This one is for x86 and touches the ChromiumOS bootmeth only to pass the size.
Patches 1-3 add sandbox tests (bootflow_extlinux_include, bootmeth_read_reserved and two more partitions in the bootflow_cros image) which fail without the fix and pass with it. All the bootstd tests pass on sandbox with the series applied, and patch 4 builds for qemu-x86_64.
The patches are independent of each other.
CI: Azure build 13713 passed, all jobs, with this series on
https://github.com/u-boot/u-boot/pull/1064, a CI-only pull request, merged with main 3973f3c4d24:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=13713
Ana Bobillo (4):
boot: pxe: Refuse 'include' in a config file read by a bootmeth
fs: Check reserved memory when bootmeths and sysboot read files
bootstd: cros: Check where the preamble puts the bootloader
x86: zimage: Bound the kernel version string to the image
arch/x86/lib/zimage.c | 27 ++++++++++----- boot/bootmeth-uclass.c | 2 +- boot/bootmeth_cros.c | 31 +++++++++++++++-- boot/bootmeth_extlinux.c | 3 ++ boot/bootmeth_pxe.c | 3 ++ boot/pxe_utils.c | 7 ++++ cmd/sysboot.c | 2 +- fs/fs.c | 12 +++++-- include/bootm.h | 6 ++-- include/fs.h | 19 ++++++++++ include/pxe_utils.h | 3 ++ test/boot/bootflow.c | 51 +++++++++++++++++++++++++-- test/boot/bootmeth.c | 75 ++++++++++++++++++++++++++++++++++++++++ test/py/tests/test_ut.py | 22 +++++++++--- 14 files changed, 238 insertions(+), 25 deletions(-)
base-commit: 03e45557e1f38a39a0c80fe30483130ff376cf92
PATCH 1/4 boot: pxe: Refuse 'include' in a config file read by a bootmeth
From: Ana Bobillo <[email protected]>
The pxe parser reads a file named by an 'include' or 'menu include' directive to the memory just after the text of the file that includes it, then parses it from there:
err = handle_include(ctx, &p, base + ALIGN(strlen(b), 4), cfg, nest_level + 1);
This suits the pxe and sysboot commands, which read the config file to ${pxefile_addr_r} in free RAM, but the extlinux and pxe bootmeths parse the config file from a heap buffer allocated to fit it, so there is no room after it. Since extlinux_getfile() accepts a file of up to 1GB, an include writes the included file past the end of that buffer, over whatever follows it in the heap. The included file comes from the boot media (or a TFTP server), so its size is not under U-Boot's control.
Add a no_include flag to the PXE context and set it in these bootmeths, so that an 'include' is refused rather than written past the buffer. Includes could not work reliably there anyway; with LMB, the heap is also reserved memory, which TFTP already refuses to write. The pxe and sysboot commands are unchanged.
Add a test which boots an extlinux config containing an 'include'.
--- boot/bootmeth_extlinux.c | 3 +++ boot/bootmeth_pxe.c | 3 +++ boot/pxe_utils.c | 7 +++++++ include/pxe_utils.h | 3 +++ test/boot/bootflow.c | 44 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+)
boot/bootmeth_extlinux.c +3 -0
@@ -173,6 +173,9 @@ static int extlinux_boot(struct udevice *dev, struct bootflow *bflow)if (ret)return log_msg_ret ("ctx" , -EINVAL ); +/* The config file is in a buffer of its own size */ + ctx.no_include = true; + ret =pxe_process (&ctx, addr, false);if (ret)return log_msg_ret ("bread" , -EINVAL );
boot/bootmeth_pxe.c +3 -0
@@ -143,6 +143,9 @@ static int extlinux_pxe_boot(struct udevice *dev, struct bootflow *bflow)if (ret)return log_msg_ret ("ctx" , -EINVAL ); +/* The config file is in a buffer of its own size */ + ctx->no_include = true; + ret =pxe_process (ctx, addr, false);if (ret)return log_msg_ret ("bread" , -EINVAL );
boot/pxe_utils.c +7 -0
@@ -1142,6 +1142,13 @@ static int handle_include(struct pxe_context *ctx, char **c, unsigned long base,return err; } +/* The included file is read to @base, after the file including it */ +if (ctx->no_include) { +printf ("Include not supported: %s\n" , include_path); +free (include_path); +return -EOPNOTSUPP ; + } + err =get_pxe_file (ctx, include_path, base);if (err <0 ) {printf ("Couldn't retrieve %s\n" , include_path);
include/pxe_utils.h +3 -0
@@ -107,6 +107,8 @@ typedef int (*pxe_getfile_func)(struct pxe_context *ctx, const char *file_path,* @bootdir: Directory that files are loaded from ("" if no directory). This is * allocated * @pxe_file_size: Size of the PXE file +* @no_include: true to refuse 'include' and 'menu include', since the PXE +* file is in a buffer with no room after it for an included file * @use_ipv6: TRUE : use IPv6 addressing, FALSE : use IPv4 addressing * @use_fallback: TRUE : use "fallback" option as default, FALSE : use * "default" option as default
@@ -129,6 +131,7 @@ struct pxe_context {bool allow_abs_path;char *bootdir;ulong pxe_file_size; +bool no_include;bool use_ipv6;bool use_fallback; };
test/boot/bootflow.c +44 -0
50 lines not on this page · raw message
Re: [PATCH 1/4] boot: pxe: Refuse 'include' in a config file read by a bootmeth
On Mon, Nov 02, 2026 at 07:03:48AM +0000, Ana Bobillo wrote:
[snip]
include/pxe_utils.h typedef int (*pxe_getfile_func)(struct pxe_context *ctx, const char *file_path, · line 114
Quoted 13 lines
include/pxe_utils.h +2
-0@@ -107,6 +107,8 @@ typedef int (*pxe_getfile_func)(struct pxe_context *ctx, const char *file_path,* @bootdir: Directory that files are loaded from ("" if no directory). This is * allocated * @pxe_file_size: Size of the PXE file +* @no_include: true to refuse 'include' and 'menu include', since the PXE +* file is in a buffer with no room after it for an included file * @use_ipv6: TRUE : use IPv6 addressing, FALSE : use IPv4 addressing * @use_fallback: TRUE : use "fallback" option as default, FALSE : use * "default" option as default
The rest of the comment block here has a specific format for documenting bools, as we see in context. Adding 'no_include' must follow this style. Otherwise seems reasonable, thanks.
Signature · 1 line
Tom
PATCH 2/4 fs: Check reserved memory when bootmeths and sysboot read files
In reply to Ana BobilloFrom: Ana Bobillo <[email protected]>
Since commit aa3c609e2be5 ("fs: prevent overwriting reserved memory"), which fixed CVE-2018-18440, the load command refuses to read a file over reserved memory, such as U-Boot's own code, stack and heap. The bootmeths and the sysboot command read files with fs_read() instead, which does not have that check:
- bootmeth_common_read_file() only checks the size of the file against a limit given by the caller, which is 1GB for extlinux and EFI
- sysboot_read_file() does not check the size at all. sysboot used the load commands, and so had the check, until
commit 81a2f8d34b4e ("pxe: Refactor sysboot to have one helper")
So a large kernel, initrd, FDT or config file on the boot media, read to an address taken from the environment, such as ${kernel_addr_r}, can be written over U-Boot itself.
Export the read which the load command uses as fs_read_checked() and use it in do_load(), bootmeth_common_read_file() and sysboot_read_file(). Close the filesystem when the check fails, as a successful read does, since a bootflow scan can now fail the check many times.
Bootmeths now refuse to read a file over reserved memory just as the load command does, so a board whose environment puts ${kernel_addr_r} or similar in a reserved region will see an error where the file was written over that region before.
Add a test which tries to read a file to reserved memory with a bootmeth and with sysboot.
--- boot/bootmeth-uclass.c | 2 +- cmd/sysboot.c | 2 +- fs/fs.c | 12 +++++-- include/fs.h | 19 +++++++++++ test/boot/bootmeth.c | 75 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 4 deletions(-)
boot/bootmeth-uclass.c +1 -1
@@ -449,7 +449,7 @@ int bootmeth_common_read_file(struct udevice *dev, struct bootflow *bflow,if (ret)return log_msg_ret ("fs" , ret); - ret =fs_read (file_path, addr,0 ,0 , &len_read); + ret =fs_read_checked (file_path, addr,0 ,0 , &len_read);if (ret)return ret; *sizep = len_read;
cmd/sysboot.c +1 -1
@@ -35,7 +35,7 @@ static int sysboot_read_file(struct pxe_context *ctx, const char *file_path, ret =fs_set_blk_dev (info->ifname, info->dev_part_str, info->fstype);if (ret)return ret; - ret =fs_read (file_path, addr,0 ,0 , &len_read); + ret =fs_read_checked (file_path, addr,0 ,0 , &len_read);if (ret)return ret; *sizep = len_read;
fs/fs.c +10 -2
@@ -682,8 +682,10 @@ static int _fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,#if CONFIG_IS_ENABLED (LMB )if (do_lmb_check) { ret =fs_read_lmb_check (filename, addr, offset, len, info); -if (ret) +if (ret) { +fs_close ();return ret; + } }#endif
@@ -709,6 +711,12 @@ int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,return _fs_read (filename, addr, offset, len,0 , actread); } +int fs_read_checked (const char *filename,ulong addr,loff_t offset, +loff_t len,loff_t *actread) +{ +return _fs_read (filename, addr, offset, len,1 , actread); +} +int fs_write (const char *filename,ulong addr,loff_t offset,loff_t len,loff_t *actwrite) {
@@ -911,7 +919,7 @@ int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], pos =0 ; time =get_timer (0 ); - ret =_fs_read (filename, addr, pos, bytes,1 , &len_read); + ret =fs_read_checked (filename, addr, pos, bytes, &len_read); time =get_timer (time);if (ret <0 ) {log_err ("Failed to load '%s'\n" , filename);
include/fs.h +19 -0
@@ -152,6 +152,25 @@ int fs_size(const char *filename, loff_t *size);int fs_read (const char *filename,ulong addr,loff_t offset,loff_t len,loff_t *actread); +/** +* fs_read_checked() - read a file without overwriting reserved memory +* +* This is like fs_read() but, as the 'load' command does, it refuses to read +* a file over memory that is reserved (if LMB is enabled), such as U-Boot +* itself. Use this to read a file whose size is not under the caller's +* control to an address that is not a buffer the caller allocated. +* +* @filename: full path of the file to read from +* @addr: address of the buffer to write to +* @offset: offset in the file from where to start reading +* @len: the number of bytes to read. Use 0 to read entire file. +* @actread: returns the actual number of bytes read +* Return: 0 if OK with valid @actread, -ENOSPC if the file would overwrite +* reserved memory, other -ve value on other error +*/ +int fs_read_checked (const char *filename,ulong addr,loff_t offset, +loff_t len,loff_t *actread); +/** * fs_write() - write file to the partition previously set by fs_set_blk_dev() *
test/boot/bootmeth.c +75 -0
88 lines not on this page · raw message
PATCH 3/4 bootstd: cros: Check where the preamble puts the bootloader
In reply to Ana BobilloFrom: Ana Bobillo <[email protected]>
cros_read_info() reads the kernel command line, the x86 setup block and the bootloader into a buffer of bootloader_size + 8KB bytes, from an offset worked out from bootloader_address - body_load_address. All three fields come from the kernel preamble on disk and nothing checks them, so:
- on 32-bit machines, bootloader_size + 8KB can wrap, leaving the buffer too small for the command line and setup block, which cros_read_buf() reads from it
- cros_read_kernel() later points the x86 setup block at an offset into the kernel body worked out from the same fields, which can be outside the body
Reject the partition unless the command line and setup block lie in the kernel body before the bootloader, and the bootloader ends within the body, as the ChromiumOS kernel layout has it.
cros_read_info() can now fail before it sets priv->info_buf, which cros_read_bootflow() frees on failure. Since priv comes from malloc(), that frees whatever the heap left there, as a read error already could. Allocate priv with calloc() so that the pointer is NULL until it is set.
Extend the ChromiumOS test image with two kernel partitions whose bootloader is too near the start of the body or ends past the end of the body. Neither may produce a bootflow.
--- boot/bootmeth_cros.c | 24 +++++++++++++++++++++++- test/boot/bootflow.c | 7 ++++--- test/py/tests/test_ut.py | 22 +++++++++++++++++----- 3 files changed, 44 insertions(+), 9 deletions(-)
boot/bootmeth_cros.c +23 -1
@@ -272,6 +272,7 @@ static int cros_read_info(struct bootflow *bflow, const char *uuid,struct udevice *blk = bflow->blk;struct blk_desc *desc =dev_get_uclass_plat (blk);ulong offset, size, before_base; +u64 bl_offset;void *buf;int ret;
@@ -285,6 +286,27 @@ static int cros_read_info(struct bootflow *bflow, const char *uuid, (ulong )preamble->bootloader_address, (ulong)preamble->bootloader_size); +/* +* The command line and setup block come just before the bootloader, +* all within the kernel body. These fields come from the disk and +* cannot be trusted, so check that the regions are where they should be +*/ +if (preamble->bootloader_address < preamble->body_load_address) { +log_debug ("- invalid bootloader address\n" ); +return log_msg_ret ("bla" , -ERANGE ); + } + bl_offset = preamble->bootloader_address - + preamble->body_load_address; +if (bl_offset < -CMDLINE_OFFSET || + bl_offset > preamble->body_signature.data_size || + preamble->bootloader_size > + preamble->body_signature.data_size - bl_offset) { +log_debug ("- invalid bootloader offset %llx size %x\n" , + (unsigned long long )bl_offset, + preamble->bootloader_size); +return log_msg_ret ("bls" , -ERANGE ); + } + priv->body_size = preamble->body_signature.data_size; priv->body_load_address = preamble->body_load_address; priv->bootloader_address = preamble->bootloader_address;
@@ -406,7 +428,7 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)return log_msg_ret ("bod" , -ERANGE ); } - priv =malloc (sizeof (struct cros_priv )); + priv =calloc (1 ,sizeof (struct cros_priv ));if (!priv) {free (hdr);return log_msg_ret ("buf" , -ENOMEM );
test/boot/bootflow.c +4 -3
@@ -1488,9 +1488,10 @@ static int bootflow_cros(struct unit_test_state *uts) {/* * mmc5 has valid kernels in partitions 2 and 4 and corrupt kernel -* metadata in partitions 6, 13, 14 and 15 (oversized keyblock, -* undersized body offset, wrapped body offset, undersized keyblock), -* none of which may produce a bootflow +* metadata in partitions 6, 13, 14, 15, 16 and 17 (oversized keyblock, +* undersized body offset, wrapped body offset, undersized keyblock, +* bootloader too near the start of the body, bootloader past the end +* of the body), none of which may produce a bootflow */ ut_assertok (scan_mmc_bootdev (uts,"mmc5" , true));ut_assertok (run_command ("bootflow list" ,0 ));
test/py/tests/test_ut.py +17 -5
@@ -408,6 +408,8 @@ def setup_cros_image(ubman): {'num': 0xd, 'label':'KERN_D', 'type': uuid_kern, 'size': '1'}, {'num': 0xe, 'label':'KERN_E', 'type': uuid_kern, 'size': '1'}, {'num': 0xf, 'label':'KERN_F', 'type': uuid_kern, 'size': '1'}, + {'num': 0x10, 'label':'KERN_G', 'type': uuid_kern, 'size': '1'}, + {'num': 0x11, 'label':'KERN_H', 'type': uuid_kern, 'size': '1'}, ] for part in required_parts:
@@ -462,18 +464,21 @@ def setup_cros_image(ubman): set_part_data(2, pack_kernel(ubman, 'x86', kern, dummy)) set_part_data(4, pack_kernel(ubman, 'arm', kern, dummy)) - def bad_kernel_part(keyblock_size, preamble_size): + def bad_kernel_part(keyblock_size, preamble_size, + bootloader_address=0x103000, bootloader_size=0x1000): """Build corrupt-kernel-partition data that U-Boot must reject The keyblock carries a valid magic and the given keyblock_size; a - preamble with the given preamble_size follows it. The bootloader - address/size fields are chosen so that, were the partition not - rejected, scanning it would succeed and produce a spurious ready + preamble with the given preamble_size follows it. The default + bootloader address/size fields are chosen so that, were the partition + not rejected, scanning it would succeed and produce a spurious ready bootflow, which the bootflow-list assertions would then catch. Args: keyblock_size (int): Value for the keyblock_size field preamble_size (int): Value for the preamble_size field + bootloader_address (int): Value for the bootloader_address field + bootloader_size (int): Value for the bootloader_size field Return: bytes: Data to place at the start of the partition
@@ -484,7 +489,8 @@ def setup_cros_image(ubman): # bootloader_size at offsets 48 / 56 / 64, body-signature data_size # at offset 88 pre = struct.pack('<I', preamble_size).ljust(48, b'\0') - pre += struct.pack('<QQI', 0x100000, 0x103000, 0x1000) + pre += struct.pack('<QQI', 0x100000, bootloader_address, + bootloader_size) pre = pre.ljust(88, b'\0') + struct.pack('<I', 0x4000) return kblock + pre
@@ -496,10 +502,16 @@ def setup_cros_image(ubman): # - partition 14 (KERN_E): preamble_size wrapping the 32-bit body offset # - partition 15 (KERN_F): keyblock_size smaller than the keyblock header, # placing the claimed preamble inside the header + # - partition 16 (KERN_G): bootloader_address placing the command line + # before the start of the kernel body + # - partition 17 (KERN_H): bootloader_size extending the bootloader past + # the end of the kernel body set_part_data(6, bad_kernel_part(0xffffffff, 0x800)) set_part_data(0xd, bad_kernel_part(0x100, 0x800)) set_part_data(0xe, bad_kernel_part(0x100, 0xffffff10)) set_part_data(0xf, bad_kernel_part(0x18, 0x1000)) + set_part_data(0x10, bad_kernel_part(0x100, 0x1000, 0x101000)) + set_part_data(0x11, bad_kernel_part(0x100, 0x1000, 0x103000, 0x10000)) with open(fname, 'wb') as outf: outf.write(disk_data)
PATCH 4/4 x86: zimage: Bound the kernel version string to the image
In reply to Ana BobilloFrom: Ana Bobillo <[email protected]>
zimage_get_kernel_version() finds the version string at an offset of up to 64KB from the kernel base, taken from the kernel_version field of the setup header, and then scans it up to its nul terminator. It works out a 256-byte limit for the scan but never checks it, and it does not know how much of the image is there to read.
This matters for the ChromiumOS bootmeth, which reads the kernel setup data from disk into a buffer of bootloader_size + 8KB bytes and passes a kernel base 24KB into that buffer. With a bootloader of less than 16KB, the kernel base is already past the end of the buffer, and the header fields come from the disk.
Pass zimage_get_kernel_version() the number of bytes it may read at the kernel base, and stop the scan at the 256-byte limit. The zboot code passes the size of the setup code, which holds the string according to the boot protocol, and the ChromiumOS bootmeth passes what is left of its buffer.
A version string longer than 255 characters is no longer shown; Linux's are around 100.
--- arch/x86/lib/zimage.c | 27 ++++++++++++++++++--------- boot/bootmeth_cros.c | 7 ++++++- include/bootm.h | 6 ++++-- 3 files changed, 28 insertions(+), 12 deletions(-)
arch/x86/lib/zimage.c +18 -9
@@ -145,11 +145,12 @@ static int setup_device_tree(struct setup_header *hdr, const void *fdt_blob) }const char *zimage_get_kernel_version (struct boot_params *params, -void *kernel_base) +void *kernel_base,ulong size) {struct setup_header *hdr = ¶ms->hdr; -int bootproto;const char *s, *end; +ulong offset; +int bootproto; bootproto =get_boot_protocol (hdr, false); log_debug("bootproto %x, hdr->setup_sects %x\n", bootproto,
@@ -157,16 +158,23 @@ const char *zimage_get_kernel_version(struct boot_params *params,if (bootproto <0x0200 || hdr->setup_sects <15 )return NULL ; -/* sanity-check the kernel version in case it is missing */ +/* the offset comes from the image, so check it is within @size */ + offset = hdr->kernel_version +0x200 ;log_debug ("hdr->kernel_version %x, str at %p\n" , hdr->kernel_version, - kernel_base + hdr->kernel_version +0x200 ); -for (s = kernel_base + hdr->kernel_version +0x200 , end = s +0x100 ; *s; - s++) { + kernel_base + offset); +if (offset >= size) +return NULL ; + +/* sanity-check the kernel version in case it is missing */ + end = kernel_base +min (size, offset +0x100 ); +for (s = kernel_base + offset; s < end && *s; s++) {if (!isprint (*s))return NULL ; } +if (s == end) +return NULL ; -return kernel_base + hdr->kernel_version +0x200 ; +return kernel_base + offset; } struct boot_params *load_zimage(char *image, unsigned long kernel_size,
@@ -206,7 +214,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,log_debug ("Using boot protocol version %x.%02x\n" , (bootproto &0xff00 ) >>8 , bootproto &0xff ); - version =zimage_get_kernel_version (params, image); + version =zimage_get_kernel_version (params, image, setup_size);if (version)printf ("Linux kernel version %s\n" , version);else
@@ -577,7 +585,8 @@ void zimage_dump(struct boot_params *base_ptr, bool show_cmdline)print_num ("Start sys seg" , hdr->start_sys_seg);print_num ("Kernel version" , hdr->kernel_version); version =zimage_get_kernel_version (base_ptr, - (void *)state.bzimage_addr); + (void *)state.bzimage_addr, + (hdr->setup_sects +1 ) *512 );if (version)printf (" @%p: %s\n" , version, version);print_num ("Type of loader" , hdr->type_of_loader);
boot/bootmeth_cros.c +6 -1
@@ -225,9 +225,14 @@ static int cros_read_buf(struct bootflow *bflow, void *buf, ulong size,#ifdef CONFIG_X86 const char *version; +ulong kern_size =0 ; +/* The kernel base may lie beyond the end of the buffer */ +if (size > before_base +X86_KERNEL_OFFSET ) + kern_size = size - before_base -X86_KERNEL_OFFSET ; version =zimage_get_kernel_version (map_sysmem (setup,0 ), -map_sysmem (kern_base,0 )); +map_sysmem (kern_base,0 ), + kern_size);log_debug ("version %s\n" , version);if (version) bflow->name =strdup (version);
include/bootm.h +4 -2
@@ -299,10 +299,12 @@ int zboot_run(ulong addr, ulong size, ulong initrd, ulong initrd_size,* * @params: boot_params pointer * @kernel_base: base address of kernel -* Return: Kernel version as a NUL-terminated string +* @size: Number of bytes at @kernel_base which may be read +* Return: Kernel version as a NUL-terminated string, or NULL if there is no +* valid version string within @size bytes of @kernel_base */ const char *zimage_get_kernel_version (struct boot_params *params, -void *kernel_base); +void *kernel_base,ulong size);/** * zimage_dump() - Dump the metadata of a zimage