All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Holger Dengler" <dengler@linux.ibm.com>
Cc: linux-s390@vger.kernel.org,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.vom>
Subject: Re: [PATCH v1 1/1] s390/crypto: Generate intermediate CV for API partial block handling
Date: Fri, 14 Aug 2026 14:31:43 +0000	[thread overview]
Message-ID: <20260814143143.75EE41F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260814142010.259918-2-dengler@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Hardware Alignment Requirement Violation due to `__packed` attribute
--

--- Patch [1]: [PATCH v1 1/1] s390/crypto: Generate intermediate CV for API partial block handling ---
commit 6ca29d2947b71c2e1420feb8fbee6504922ff37f
Author: Holger Dengler <dengler@linux.ibm.com>

s390/crypto: Generate intermediate CV for API partial block handling

This commit updates the internal hash_data() function to conditionally use
cpacf_kimd() for intermediate chaining values when API partial block handling
is requested, reserving cpacf_klmd() for the final hash value.

> diff --git a/arch/s390/crypto/hmac_s390.c b/arch/s390/crypto/hmac_s390.c
> index f8cd09f341d4b..445fa7bbd9586 100644
> --- a/arch/s390/crypto/hmac_s390.c
> +++ b/arch/s390/crypto/hmac_s390.c
> @@ -150,7 +150,10 @@ static int hash_data(const u8 *in, unsigned int inlen,
>  
>  #undef PARAM_INIT
>  
> -	cpacf_klmd(func, &param, in, inlen);
> +	if (final)
> +		cpacf_klmd(func, &param, in, inlen);
> +	else
> +		cpacf_kimd(func, &param, in, inlen);

[Severity: High]
This is a pre-existing issue, but could the alignment of the param block passed
to cpacf_kimd() and cpacf_klmd() trigger a hardware specification exception?

The param variable is defined earlier in hash_data() with the __packed
attribute:

	union {
		struct sha256_paramblock {
			u32 h[8];
			u64 mbl;
		} sha256;
		struct sha512_paramblock {
			u64 h[8];
			u128 mbl;
		} sha512;
	} __packed param;

The __packed attribute reduces the compiler's alignment requirement for param
to 1 byte. The z/Architecture requires doubleword (8-byte) alignment for KIMD
and KLMD parameter blocks.

If the compiler places param on a stack address not divisible by 8, won't this
cause a kernel panic when passed to these hardware instructions? 

Since the struct fields inside the union are naturally packed, can we remove
the __packed attribute to ensure the compiler maintains safe alignment?

>  
>  	memcpy(digest, &param, digestsize);
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260814142010.259918-2-dengler@linux.ibm.com?part=1

  parent reply	other threads:[~2026-08-14 14:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 14:20 [PATCH v1 0/1] s390/crypto: Generate iintermediate chaining value on export Holger Dengler
2026-08-14 14:20 ` [PATCH v1 1/1] s390/crypto: Generate intermediate CV for API partial block handling Holger Dengler
2026-08-14 14:29   ` Harald Freudenberger
2026-08-14 14:31   ` sashiko-bot [this message]
2026-08-14 15:08     ` Holger Dengler

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=20260814143143.75EE41F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.vom \
    --cc=dengler@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 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.