linux-yocto/arch/s390
Eric Biggers 56ea774604 crypto: s390/sha - Fix uninitialized variable in SHA-1 and SHA-2
commit 6827938026 upstream.

Commit 88c02b3f79 ("s390/sha3: Support sha3 performance enhancements")
added the field s390_sha_ctx::first_message_part and made it be used by
s390_sha_update() (now s390_sha_update_blocks()).  At the time,
s390_sha_update() was used by all the s390 SHA-1, SHA-2, and SHA-3
algorithms.  However, only the initialization functions for SHA-3 were
updated, leaving SHA-1 and SHA-2 using first_message_part uninitialized.

This could cause e.g. the function code CPACF_KIMD_SHA_512 |
CPACF_KIMD_NIP to be used instead of just CPACF_KIMD_SHA_512.  This
apparently was harmless, as the SHA-1 and SHA-2 function codes ignore
CPACF_KIMD_NIP; it is recognized only by the SHA-3 function codes
(https://lore.kernel.org/r/73477fe9-a1dc-4e38-98a6-eba9921e8afa@linux.ibm.com/).
Therefore, this bug was found only when first_message_part was later
converted to a boolean and UBSAN detected its uninitialized use.
Regardless, let's fix this by just initializing to zero.

Note: in 6.16, we need to patch SHA-1, SHA-384, and SHA-512.  In 6.15
and earlier, we'll also need to patch SHA-224 and SHA-256, as they
hadn't yet been librarified (which incidentally fixed this bug).

Fixes: 88c02b3f79 ("s390/sha3: Support sha3 performance enhancements")
Cc: stable@vger.kernel.org
Reported-by: Ingo Franzki <ifranzki@linux.ibm.com>
Closes: https://lore.kernel.org/r/12740696-595c-4604-873e-aefe8b405fbf@linux.ibm.com
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Link: https://lore.kernel.org/r/20250703172316.7914-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-17 18:37:01 +02:00
..
appldata sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
boot s390/boot: Fix ESSA detection 2025-02-27 04:30:22 -08:00
configs s390: Update defconfigs 2024-10-16 11:32:32 +02:00
crypto crypto: s390/sha - Fix uninitialized variable in SHA-1 and SHA-2 2025-07-17 18:37:01 +02:00
hypfs hypfs_create_cpu_files(): add missing check for hypfs_mkdir() failure 2025-05-29 11:02:15 +02:00
include s390/tlb: Use mm_has_pgste() instead of mm_alloc_pgste() 2025-05-29 11:02:13 +02:00
kernel s390/entry: Fix last breaking event handling in case of stack corruption 2025-05-18 08:24:47 +02:00
kvm KVM: s390: rename PROT_NONE to PROT_TYPE_DUMMY 2025-06-27 11:11:23 +01:00
lib s390/alternatives: Rework to allow for callbacks 2024-07-23 16:02:31 +02:00
mm s390: Remove ioremap_wt() and pgprot_writethrough() 2025-04-10 14:39:18 +02:00
net s390/bpf: Store backchain even for leaf progs 2025-06-19 15:31:49 +02:00
pci s390/pci: Do not try re-enabling load/store if device is disabled 2025-07-10 16:04:41 +02:00
purgatory s390: Add '-std=gnu11' to decompressor and purgatory CFLAGS 2025-02-08 09:58:19 +01:00
tools s390 updates for 6.12 merge window 2024-09-21 09:02:54 -07:00
Kbuild
Kconfig s390/sclp: Initialize sclp subsystem via arch_cpu_finalize_init() 2025-02-08 09:58:07 +01:00
Kconfig.debug
Makefile s390: Fix linker error when -no-pie option is unavailable 2025-04-20 10:15:59 +02:00
Makefile.postlink s390/build: Avoid relocation information in final vmlinux 2024-08-27 20:16:48 +02:00