All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: marcandre.lureau@redhat.com
Cc: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH 1/2] crypto: avoid overwriting Error object erasing keyslot
Date: Mon, 26 Oct 2026 06:20:29 +0100	[thread overview]
Message-ID: <87se1t6ns2.fsf@pond.sub.org> (raw)
In-Reply-To: <179278610144.473507.3670274283995738536.b4-review@b4> (marcandre lureau's message of "Sat, 24 Oct 2026 00:08:21 +0400")

marcandre.lureau@redhat.com writes:

>> When erasing a keyslot we deliberately ignore some errors and
>> carry on trying to erase as much as possible. This results in
>> overwriting Error objects and triggering an assertion. Don't
>> pass in the &local_err, if errp is already set.
>> 
>> Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/4697
>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>> Message-ID: <20261023141303.163893-2-berrange@redhat.com>
>> ---
>>  crypto/block-luks.c | 17 +++++++++++++----
>>  1 file changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/crypto/block-luks.c b/crypto/block-luks.c
>> index 0926ad28f0cd..8a1df846a146 100644
>> --- a/crypto/block-luks.c
>> +++ b/crypto/block-luks.c
>> @@ -1152,22 +1152,29 @@ qcrypto_block_luks_erase_key(QCryptoBlock *block,
>>  
>>      if (ret < 0) {
>>          error_propagate(errp, local_err);
>> +        local_err = NULL;
>>      }
>> +
>>      /*
>>       * Now try to erase the key material, even if the header
>>       * update failed
>>       */
>>      for (i = 0; i < QCRYPTO_BLOCK_LUKS_ERASE_ITERATIONS; i++) {
>>          if (qcrypto_random_bytes(garbagesplitkey,
>> -                                 splitkeylen, &local_err) < 0) {
>> +                                 splitkeylen,
>> +                                 errp && *errp ? NULL : &local_err) < 0) {
>
> I think the current code was simpler. error_propagate() will simpliy discard local_err if errp is already set. It is just missing "local_err = NULL;"

Moreover, *errp is wrong without ERRP_GUARD().

[...]



  reply	other threads:[~2026-10-26  5:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 14:13 [PATCH 0/2] crypto: fix handling & reporting of errors when erasing keyslots Daniel P. Berrangé
2026-10-23 14:13 ` [PATCH 1/2] crypto: avoid overwriting Error object erasing keyslot Daniel P. Berrangé
2026-10-23 20:08   ` marcandre.lureau
2026-10-26  5:20     ` Markus Armbruster [this message]
2026-10-23 14:13 ` [PATCH 2/2] crypto: add newline in error hint messages Daniel P. Berrangé
2026-10-23 20:08   ` marcandre.lureau

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=87se1t6ns2.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.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 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.