All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH v2 1/2] crypto: avoid overwriting Error object erasing keyslot
Date: Thu, 12 Nov 2026 17:42:41 +0000	[thread overview]
Message-ID: <avX6kV6GMYSXtsID@redhat.com> (raw)
In-Reply-To: <179311125460.913211.3496484666027902541.b4-review@b4>

On Tue, Oct 27, 2026 at 06:27:34PM +0400, marcandre.lureau@redhat.com wrote:
> > 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: <20261026111237.660633-2-berrange@redhat.com>
> > ---
> >  crypto/block-luks.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/crypto/block-luks.c b/crypto/block-luks.c
> > index 0926ad28f0cd..277a51106072 100644
> > --- a/crypto/block-luks.c
> > +++ b/crypto/block-luks.c
> > @@ -1152,6 +1152,7 @@ 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
> > @@ -1169,6 +1170,7 @@ qcrypto_block_luks_erase_key(QCryptoBlock *block,
> >              if (i > 0) {
> >                  return -1;
> >              }
> > +            local_err = NULL;
> 
> This is the recoverable path: the comment says we still write zeros and
> carry on, so a first-iteration random failure is not meant to be fatal. But
> error_propagate(errp, local_err) has just stored that error in *errp.
> 
> Keep the first-iteration failure as non-fatal but do not hand it to errp?
> (e.g. error_free(local_err) instead of error_propagate() when i == 0)

From the POV of the caller, we always want to report an error back
to them. We just want to try todo as much erasing as possible, even
when we're reporting an error. So don't think of this as a recover
from error sucess path. It is still a fatal error overall.


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



  reply	other threads:[~2026-11-12 17:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 11:12 [PATCH v2 0/2] crypto: fix handling & reporting of errors when erasing keyslots Daniel P. Berrangé
2026-10-26 11:12 ` [PATCH v2 1/2] crypto: avoid overwriting Error object erasing keyslot Daniel P. Berrangé
2026-10-26 11:51   ` Markus Armbruster
2026-10-27 14:27   ` marcandre.lureau
2026-11-12 17:42     ` Daniel P. Berrangé [this message]
2026-10-26 11:12 ` [PATCH v2 2/2] crypto: add newline in error hint messages Daniel P. Berrangé
2026-10-26 11:51   ` Markus Armbruster
2026-10-27 14:27   ` 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=avX6kV6GMYSXtsID@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@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.