From: Herbert Xu <herbert@gondor.apana.org.au>
To: Daniel Pouzzner <douzzer@mega.nu>
Cc: Thorsten Leemhuis <regressions@leemhuis.info>,
Taeyang Lee <0wn@theori.io>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
Eric Biggers <ebiggers@kernel.org>,
Linus Torvalds <torvalds@linuxfoundation.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Greg KH <gregkh@linuxfoundation.org>,
davem@davemloft.net, Brian Pak <bpak@theori.io>,
Juno Im <juno@theori.io>, Jungwon Lim <setuid0@theori.io>,
Linux kernel regressions list <regressions@lists.linux.dev>
Subject: [v2 PATCH] crypto: algif_aead - Fix minimum RX size check for decryption
Date: Sun, 12 Apr 2026 13:32:21 +0800 [thread overview]
Message-ID: <adsuZfIjp6OcaAsi@gondor.apana.org.au> (raw)
In-Reply-To: <ac3f34e743737c128c289576c1f134d1991d4552.camel@mega.nu>
On Fri, Apr 10, 2026 at 10:33:39AM -0500, Daniel Pouzzner wrote:
>
> Meanwhile, next-20260409 with your point patches to
> crypto/algif_aead.c:_aead_recvmsg() and crypto/af_alg.c:af_alg_pull_tsgl()
> deterministically produces wrong results on these:
>
> [FAILED: 64-bit - 7.1.0-rc7-next-next-20260409-dirty] AEAD ccm(aes) asynchronous one shot multiple test
> (/usr/local/libexec/libkcapi/kcapi -d 4 -x 10 -c ccm(aes) -q 4edb58e8d5eb6bc711c43a6f3693daebde2e5524f1b55297abb29f003236e43d -t a7877c99 -n 674742abd0f5ba -k 2861fd0253705d7875c95ba8a53171b4 -a fb7bc304a3909e66e2e0c5ef952712dd884ce3e7324171369f2c5db1adc48c7d)
> Exp 8dd351509dcf1df9[...]
> Got EBADMSG
Sorry I got the maths wrong. This one works for me:
---8<---
The check for the minimum receive buffer size did not take the
tag size into account during decryption. Fix this by adding the
required extra length.
Reported-by: syzbot+aa11561819dc42ebbc7c@syzkaller.appspotmail.com
Reported-by: Daniel Pouzzner <douzzer@mega.nu>
Fixes: d887c52d6ae4 ("crypto: algif_aead - overhaul memory management")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index dda15bb05e89..f8bd45f7dc83 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -144,7 +144,7 @@ static int _aead_recvmsg(struct socket *sock, struct msghdr *msg,
if (usedpages < outlen) {
size_t less = outlen - usedpages;
- if (used < less) {
+ if (used < less + (ctx->enc ? 0 : as)) {
err = -EINVAL;
goto free;
}
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2026-04-12 5:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 9:21 [PATCH] crypto: authencesn - Copy high sequence number from src after out-of-place decryption Herbert Xu
2026-03-25 16:23 ` Linus Torvalds
2026-03-26 4:17 ` Herbert Xu
2026-03-26 6:45 ` Herbert Xu
2026-03-26 6:46 ` [PATCH] crypto: authencesn - Use memcpy_from/to_sglist Herbert Xu
2026-05-02 4:53 ` [v2 PATCH] " Herbert Xu
2026-03-25 17:59 ` [PATCH] crypto: authencesn - Copy high sequence number from src after out-of-place decryption Taeyang Lee
2026-03-26 6:30 ` [PATCH] crypto: algif_aead - Revert to operating out-of-place Herbert Xu
2026-03-26 17:43 ` Taeyang Lee
2026-04-03 4:49 ` Taeyang Lee
2026-04-03 5:15 ` Taeyang Lee
2026-04-09 15:24 ` Thorsten Leemhuis
2026-04-10 14:52 ` Herbert Xu
2026-04-10 15:33 ` Daniel Pouzzner
2026-04-12 5:32 ` Herbert Xu [this message]
2026-04-13 18:46 ` [v2 PATCH] crypto: algif_aead - Fix minimum RX size check for decryption Daniel Pouzzner
2026-03-27 6:04 ` [v2 PATCH] crypto: authencesn - Do not place hiseq at end of dst for out-of-place decryption 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=adsuZfIjp6OcaAsi@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=0wn@theori.io \
--cc=bpak@theori.io \
--cc=davem@davemloft.net \
--cc=douzzer@mega.nu \
--cc=ebiggers@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=juno@theori.io \
--cc=kuba@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=regressions@leemhuis.info \
--cc=regressions@lists.linux.dev \
--cc=setuid0@theori.io \
--cc=torvalds@linuxfoundation.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