From: sashiko-bot@kernel.org
To: "Harald Freudenberger" <freude@linux.ibm.com>
Cc: "Heiko Carstens" <hca@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
linux-s390@vger.kernel.org,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH v3 2/6] s390/crypto: Fix missing scrub of temp buffers with PAES algorithm
Date: Mon, 17 Aug 2026 14:23:32 +0000 [thread overview]
Message-ID: <20260817142332.A81951F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260817141654.77940-3-freude@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The unprotected AES implementation (`aes_s390.c`) suffers from the same missing stack buffer scrub issue that this patch fixes in `paes_s390.c`, leading to potential leakage of plaintext, ciphertext, and AES-CTR keystream bytes.
--
--- Patch [2]: [PATCH v3 2/6] s390/crypto: Fix missing scrub of temp buffers with PAES algorithm ---
commit 35a0f4315bfc23077f4581853ff227c37d38d817
Author: Harald Freudenberger <freude@linux.ibm.com>
s390/crypto: Fix missing scrub of temp buffers with PAES algorithm
In function ctr_paes_do_crypt() there is a buffer used to process
remaining bytes < AES_BLOCK_SIZE. This buffer was not scrubbed and
thus could lead to expose of unwanted data. Rework the code to
explicitly scrub the buffer at the end of the function to avoid
exposure of maybe sensitive data.
In function __xts_2keys_prep_param() change the existing scrub to
clean the whole param block instead of just the key field.
Cc: stable@vger.kernel.org # 6.16+
> diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c
> index ccc7da106c3a0..d075b0241f1f5 100644
> --- a/arch/s390/crypto/paes_s390.c
> +++ b/arch/s390/crypto/paes_s390.c
> @@ -1044,6 +1044,7 @@ static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx,
> }
>
> out:
> + memzero_explicit(buf, sizeof(buf));
[Severity: High]
This isn't a bug introduced by this patch, but does the unprotected aes
implementation in arch/s390/crypto/aes_s390.c suffer from the same missing
stack buffer scrub issue?
Looking at ctr_aes_crypt() and gcm_aes_crypt() in aes_s390.c, there are stack
buffers used for partial blocks that appear to be left unscrubbed:
arch/s390/crypto/aes_s390.c:ctr_aes_crypt() {
...
ret = skcipher_walk_done(&walk, 0);
}
return ret;
}
arch/s390/crypto/aes_s390.c:gcm_aes_crypt() {
...
memzero_explicit(¶m, sizeof(param));
return ret;
}
The 16-byte stack buffer buf in ctr_aes_crypt() holds plaintext, ciphertext,
and aes keystream bytes from the zero-padding xored with the ctr keystream.
Similarly, the gw_in and gw_out stack structures in gcm_aes_crypt() contain
16-byte buf arrays that buffer partial plaintext and ciphertext blocks.
Since any userspace process (via af_alg) utilizing s390 hardware aes-ctr
for partial block lengths, or aes-gcm for unaligned data, could trigger
this, could this lead to a potential information leak of sensitive data?
Since this patch explicitly addresses this regression in the sibling
protected aes driver (paes_s390.c), should the unprotected aes driver be
patched as well?
> pr_debug("rc=%d\n", rc);
> return rc;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260817141654.77940-1-freude@linux.ibm.com?part=2
next prev parent reply other threads:[~2026-08-17 14:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 14:16 [PATCH v3 0/6] Fixes and rework for paes_s390 Harald Freudenberger
2026-08-17 14:16 ` [PATCH v3 1/6] s390/crypto: Fix return code handling at skcipher_walk_done in PAES algorithms Harald Freudenberger
2026-08-17 14:22 ` sashiko-bot
2026-08-17 14:16 ` [PATCH v3 2/6] s390/crypto: Fix missing scrub of temp buffers with PAES algorithm Harald Freudenberger
2026-08-17 14:23 ` sashiko-bot [this message]
2026-08-17 14:16 ` [PATCH v3 3/6] s390/crypto: Fix use of mutex in atomic context in PAES Harald Freudenberger
2026-08-17 14:26 ` sashiko-bot
2026-08-17 14:16 ` [PATCH v3 4/6] s390/crypto: Fix missing cra_flags in paes_s390 Harald Freudenberger
2026-08-17 14:22 ` sashiko-bot
2026-08-17 14:16 ` [PATCH v3 5/6] s390/crypto: Fix handling of EBUSY in PAES when req is pushed to crypto engine Harald Freudenberger
2026-08-17 14:27 ` sashiko-bot
2026-08-17 14:16 ` [PATCH v3 6/6] s390/crypto: Fix handling of EBUSY in PHMAC " Harald Freudenberger
2026-08-17 14:35 ` sashiko-bot
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=20260817142332.A81951F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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