From: Mattijs Korpershoek via U-Boot <u-boot@lists.u-boot-project.org>
To: Igor Opaniuk <igor.opaniuk@gmail.com>, u-boot@lists.denx.de
Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>,
Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
"Guillaume La Roque (TI.com)" <glaroque@baylibre.com>,
"Nicolas Belin (TI.com)" <nbelin@baylibre.com>,
Francois Berder <fberder@outlook.fr>,
Sam Protsenko <semen.protsenko@linaro.org>
Subject: Re: [PATCH 0/2] avb: fix memory leaks in AVB 2.0 verification path
Date: Tue, 21 Jul 2026 10:28:13 +0200 [thread overview]
Message-ID: <877bmokaqq.fsf@kernel.org> (raw)
In-Reply-To: <CAByghJaRbP9Rx3VYRPFS+yfjKbx6y6c8wX3MyUE+HjnG_-L-4A@mail.gmail.com>
Hi Igor,
On Wed, Jul 15, 2026 at 18:29, Igor Opaniuk <igor.opaniuk@gmail.com> wrote:
> On Sun, Jul 12, 2026 at 10:50 AM Igor Opaniuk <igor.opaniuk@gmail.com> wrote:
>>
>> While reviewing the AVB 2.0 integration I noticed several memory leaks in
>> the verification path that accumulate on every boot.
>>
>> In the Android bootmethod, run_avb_verification() allocates an AvbOps via
>> avb_ops_alloc() and receives an AvbSlotVerifyData from avb_slot_verify(),
>> but frees neither on the successful return paths. Every boot therefore
>> leaks the AvbOpsData structure, and with CONFIG_OPTEE_TA_AVB the leaked
>> AvbOps also leaves the OP-TEE session open (it is only closed inside
>> avb_ops_free()). The AvbSlotVerifyData - holding the kernel cmdline and
>> loaded-partition metadata - is leaked on both the locked GREEN/OK and the
>> unlocked ORANGE/ERROR_VERIFICATION success paths.
>>
>> Independently, the AvbOps I/O helpers leak a struct mmc_part on every
>> partition access: get_partition() returns a malloc()'d descriptor that
>> only its internal error path frees, while none of its three callers
>> (mmc_byte_io(), get_unique_guid_for_partition(), get_size_of_partition())
>> release it. A single "avb verify" performs many such accesses (footer,
>> vbmeta and the hashed image chunks), so this leak grows quickly.
>>
>> No functional change intended: the GREEN/ORANGE boot-state handling and
>> the locked/unlocked acceptance logic are preserved.
>>
>> Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
>> ---
>> Igor Opaniuk (2):
>> boot: android: fix AvbOps and verify-data leaks in AVB path
>> avb: free mmc_part allocated by get_partition()
>>
>> boot/bootmeth_android.c | 37 +++++++++++++++++++++----------------
>> common/avb_verify.c | 29 +++++++++++++++++++++--------
>> 2 files changed, 42 insertions(+), 24 deletions(-)
>> ---
>> base-commit: 6741b0dfb41dc82a284ab1cff4c58af6ef2f3f9c
>> change-id: 20260712-avb-fix-memory-leaks-831cfd7e2115
>>
>> Best regards,
>> --
>> Igor Opaniuk <igor.opaniuk@gmail.com>
>>
>
> Just a gentle ping on this patch series
Sorry, I was on vacation and away from my computer. I will review this
week.
Thanks for your patience!
Mattijs
>
> --
> Best regards - Atentamente - Meilleures salutations
>
> Igor Opaniuk
>
> mailto: igor.opaniuk@gmail.com
> https://www.linkedin.com/in/iopaniuk
next prev parent reply other threads:[~2026-07-21 8:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-12 8:50 [PATCH 0/2] avb: fix memory leaks in AVB 2.0 verification path Igor Opaniuk
2026-07-12 8:50 ` [PATCH 1/2] boot: android: fix AvbOps and verify-data leaks in AVB path Igor Opaniuk
2026-07-23 12:48 ` Mattijs Korpershoek
2026-07-12 8:50 ` [PATCH 2/2] avb: free mmc_part allocated by get_partition() Igor Opaniuk
2026-07-23 12:53 ` Mattijs Korpershoek
2026-07-15 16:29 ` [PATCH 0/2] avb: fix memory leaks in AVB 2.0 verification path Igor Opaniuk
2026-07-21 8:28 ` Mattijs Korpershoek via U-Boot [this message]
2026-07-24 12:43 ` Mattijs Korpershoek
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=877bmokaqq.fsf@kernel.org \
--to=u-boot@lists.u-boot-project.org \
--cc=fberder@outlook.fr \
--cc=glaroque@baylibre.com \
--cc=igor.opaniuk@gmail.com \
--cc=mkorpershoek@kernel.org \
--cc=nbelin@baylibre.com \
--cc=semen.protsenko@linaro.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.