linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ard Biesheuvel" <ardb+git@google.com>, linux-efi@vger.kernel.org
Cc: mark.rutland@arm.com, will@kernel.org, catalin.marinas@arm.com,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Jason Gunthorpe" <jgg@nvidia.com>
Subject: Re: [PATCH 3/5] efi/zboot: Disentangle efi_remap_image() from efi_cache_sync_image()
Date: Fri, 06 Nov 2026 14:34:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-201591@kernel.org> (raw)
In-Reply-To: <20261106141936.2744481-10-ardb+git@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] efi/zboot: duplicate efi_cache_sync_image() calls after
  decompression
--

commit c04555ab5ec2e8a3cceff169f625d907a16b1267
Author: Ard Biesheuvel <ardb@kernel.org>

efi/zboot: Disentangle efi_remap_image() from efi_cache_sync_image()

This commit moves the efi_remap_image() call out of arm64's
efi_cache_sync_image() into a new efi_zboot_remap_image() helper called from
efi_zboot_entry().

> diff --git a/drivers/firmware/efi/libstub/zboot.c b/drivers/firmware/efi/libstub/zboot.c
> index 97ae706c034ad..27f6661253c08 100644
> --- a/drivers/firmware/efi/libstub/zboot.c
> +++ b/drivers/firmware/efi/libstub/zboot.c
> @@ -36,6 +36,26 @@ const struct efi_image_info * __weak zboot_get_image_info(unsigned long image_ba
>  	return NULL;
>  }
>  
> +static efi_status_t efi_zboot_remap_image(const struct efi_image_info *image_info,
> +					  unsigned long image_base,
> +					  unsigned long image_size)
> +{
> +	unsigned long code_size = efistub_get_code_size(image_info);
> +	efi_status_t status;
> +
> +	if (code_size) {
> +		efi_cache_sync_image(image_base, code_size);
> +
> +		status = efi_remap_image(image_base, image_size, code_size);
> +		if (status != EFI_SUCCESS)
> +			return status;
> +	} else {
> +		efi_cache_sync_image(image_base, image_size);
> +	}
> +
> +	return EFI_SUCCESS;
> +}

[Severity: Low]
Does calling efi_cache_sync_image() in efi_zboot_remap_image() duplicate the
cache sync already performed at the end of efi_zboot_decompress()?

0dc1754e16b4 ("efi/libstub: Avoid legacy decompressor zlib/zstd wrappers")
moved efi_cache_sync_image((unsigned long)out, outlen) into
efi_zboot_decompress() in both zboot-decompress-gzip.c and
zboot-decompress-zstd.c.  Because efi_zboot_entry() calls
efi_zboot_remap_image() right after efi_zboot_decompress(),
efi_cache_sync_image() now runs twice back-to-back on every zboot boot, first
over the full allocation and then over code_size.  Should the
efi_cache_sync_image() calls in efi_zboot_decompress() be dropped?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106141936.2744481-7-ardb+git@google.com?part=3

  reply	other threads:[~2026-11-06 14:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 14:19 [PATCH 0/5] efi: Expose loaded image properties via info struct Ard Biesheuvel
2026-11-06 14:19 ` [PATCH 1/5] efi/libstub: Make efi_remap_image() return efi_status_t Ard Biesheuvel
2026-11-06 14:36   ` sashiko-bot
2026-11-06 14:19 ` [PATCH 2/5] efi/libstub: Pass a struct efi_image_info to efi_stub_common() Ard Biesheuvel
2026-11-06 14:27   ` sashiko-bot
2026-11-06 14:19 ` [PATCH 3/5] efi/zboot: Disentangle efi_remap_image() from efi_cache_sync_image() Ard Biesheuvel
2026-11-06 14:34   ` sashiko-bot [this message]
2026-11-06 14:19 ` [PATCH 4/5] efi/arm64: Expose struct efi_image_info via the image header Ard Biesheuvel
2026-11-06 14:34   ` Jason Gunthorpe
2026-11-06 15:51     ` Ard Biesheuvel
2026-11-06 17:09       ` Jason Gunthorpe
2026-11-06 14:19 ` [PATCH 5/5] efi/arm64: Drop build and linker script hacks to obtain image code size Ard Biesheuvel
2026-11-06 14:33   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-201591@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=jgg@nvidia.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).