Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	 Harald Freudenberger <freude@linux.ibm.com>,
	 Ingo Franzki <ifranzki@linux.ibm.com>,
	linux-crypto@vger.kernel.org,  Eric Biggers <ebiggers@kernel.org>,
	dengler@linux.ibm.com,  linux-s390@vger.kernel.org,
	dm-devel@lists.linux.dev, agk@redhat.com,  snitzer@kernel.org,
	Milan Broz <gmazyland@gmail.com>
Subject: Re: [PATCH] crypto/authenc: don't return -EBUSY when enqueuing the hash request
Date: Tue, 23 Sep 2025 13:14:10 +0200 (CEST)	[thread overview]
Message-ID: <194f9d1e-b6b0-54c7-6eb8-37ac0c0c1f9d@redhat.com> (raw)
In-Reply-To: <aNIYTm6neC3lC6dP@gondor.apana.org.au>



On Tue, 23 Sep 2025, Herbert Xu wrote:

> If authenc gets EBUSY from the ahash, then the ahash is responsible
> for sending an EINPROGRESS notification.  I just checked the authenc
> code and it does pass the notification back up to the caller (which
> is dm-crypt).
> 
> So if EINPROGRESS is not being received, then it's a bug in the
> ahash layer or the underlying ahash algorithm.

static void authenc_request_complete(struct aead_request *req, int err)
{
        if (err != -EINPROGRESS)
                aead_request_complete(req, err);
}

This prevents -EINPROGRESS from reaching dm-crypt. If I remove the 
condition "err != -EINPROGRESS", the deadlock goes away. Though, removing 
it may break other things - we may send -EINPROGRESS twice, first for the 
hash and then for the decryption.

> Which phmac implementation was this?

It was pseudo_phmac out-of-tree module sent by Harald Freudenberger. He 
CC'd you, so you should have it as an attachment in your inbox.

The following scripts creates the buggy device mapper device:

#!/bin/sh -ex
sync
modprobe crypto_engine
insmod ~/c/phmac/pseudo_phmac/phmac.ko
modprobe brd rd_size=1048576
dmsetup create cr_dif --table '0 2031880 integrity 1:0 32768 32 J 7 block_size:4096 interleave_sectors:32768 buffer_sectors:128 journal_sectors:16368 journal_watermark:50 commit_time:10000 fix_padding'
dmsetup create cr --table '0 2031880 crypt capi:authenc(phmac(sha256),xts(aes))-plain64 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 252:0 0 2 integrity:32:aead sector_size:4096'
dd if=/dev/zero of=/dev/mapper/cr bs=1M oflag=direct status=progress

> Cheers,

Mikulas


  reply	other threads:[~2025-09-23 11:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250908131642.385445532@debian4.vm>
     [not found] ` <3a6b6f8f-5205-459c-810a-2425aae92fc8@linux.ibm.com>
     [not found]   ` <e1e420d5-dc00-14d0-fdef-635d6ef70811@redhat.com>
     [not found]     ` <bb68f9d6-8180-4291-9e6b-33bbdcef780f@linux.ibm.com>
     [not found]       ` <8cb59ed5-1c9a-49de-beee-01eda52ad618@linux.ibm.com>
     [not found]         ` <1af710ec-0f23-2522-d715-e683b9e557d8@redhat.com>
     [not found]           ` <f799d7ab97470f2529b8dcb5566fd673@linux.ibm.com>
2025-09-22 19:08             ` [PATCH] crypto/authenc: don't return -EBUSY when enqueuing the hash request Mikulas Patocka
2025-09-23  3:47               ` Herbert Xu
2025-09-23 11:14                 ` Mikulas Patocka [this message]
2025-09-23 14:36                   ` Mikulas Patocka
2025-09-23 15:17                   ` Herbert Xu
2025-09-24 10:20                     ` [PATCH] crypto: authenc - Correctly pass EINPROGRESS back up to the caller Herbert Xu
2025-09-24 13:17                       ` Ingo Franzki
2025-11-25 14:02                     ` [PATCH] crypto/authenc: don't return -EBUSY when enqueuing the hash request Mikulas Patocka
2025-11-26  5:16                       ` Herbert Xu

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=194f9d1e-b6b0-54c7-6eb8-37ac0c0c1f9d@redhat.com \
    --to=mpatocka@redhat.com \
    --cc=agk@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dengler@linux.ibm.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=freude@linux.ibm.com \
    --cc=gmazyland@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ifranzki@linux.ibm.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=snitzer@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