From: Vasily Gorbik <gor@linux.ibm.com>
To: Harald Freudenberger <freude@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
linux-s390@vger.kernel.org, ifranzki@linux.ibm.com
Subject: Re: [PATCH v4 0/1] Fix buffer over-read in cca_cipher2protkey
Date: Thu, 30 Jul 2026 10:50:23 +0200 [thread overview]
Message-ID: <ttizcjz@ub.hpns> (raw)
In-Reply-To: <20260729114009.187946-1-freude@linux.ibm.com>
On Wed, Jul 29, 2026 at 01:40:08PM +0200, Harald Freudenberger wrote:
> Add validation of both the actual key buffer size and token length
> fields in all the cca_check_sec*token() functions. Additionally check
> in cca_gencipherkey() for possible underflow with returned key size.
>
> The CCA token structures contain user-controlled len fields that
> were used in operations without proper validation against both the
> actual buffer size and minimum token structure size. An attacker
> could set this field larger than the actual buffer size, leading to
> reading beyond buffer boundaries. This may result in a kernel crash or
> exposure of memory via sending this as part of a request down to the
> crypto card. Also an attacker could have used a very small len value
> and thus enforce a buffer under-run which may produce similar effects
> as a over-read.
>
> So now a key must
> - key buf length must be at least sizeof the token struct
> - the key len field inside the token must fit into the range of
> sizeof key token struct ... key buf length
>
> Changelog:
> v1 - initial version
> v2 - extend the length check to all cca_check_sec*token() functions,
> also check for min given buffer length and token length field.
> v3 - there was still a possibility to under-run the length checks in
> function cca_gencipherkey(). Fixed as suggested by Ingo.
> v4 - Reviewd-by from Ingo added.
>
> Harald Freudenberger (1):
> s390/zcrypt: Fix buffer over-read in cca_cipher2protkey
>
> drivers/s390/crypto/pkey_cca.c | 15 +++----
> drivers/s390/crypto/zcrypt_ccamisc.c | 64 +++++++++++++++++++++++-----
> drivers/s390/crypto/zcrypt_ccamisc.h | 6 +--
> 3 files changed, 62 insertions(+), 23 deletions(-)
Applied, thank you!
prev parent reply other threads:[~2026-07-30 8:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 11:40 [PATCH v4 0/1] Fix buffer over-read in cca_cipher2protkey Harald Freudenberger
2026-07-29 11:40 ` [PATCH v4 1/1] s390/zcrypt: " Harald Freudenberger
2026-07-29 12:06 ` sashiko-bot
2026-07-29 13:49 ` Harald Freudenberger
2026-07-30 8:50 ` Vasily Gorbik [this message]
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=ttizcjz@ub.hpns \
--to=gor@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=ifranzki@linux.ibm.com \
--cc=linux-s390@vger.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