* [PATCH v3] s390/cpacf: Unpoison instruction results
@ 2026-08-14 12:15 Ilya Leoshkevich
2026-08-19 22:14 ` Vasily Gorbik
0 siblings, 1 reply; 2+ messages in thread
From: Ilya Leoshkevich @ 2026-08-14 12:15 UTC (permalink / raw)
To: Harald Freudenberger, Holger Dengler, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev
Cc: linux-s390, linux-kernel, Ilya Leoshkevich
Stop KMSAN from complaining about CPACF outputs being uninitialized.
Do not unpoison variable-length parameter blocks: mapping function
codes (like CPACF_KIMD_SHA_256) to lengths will be ugly. So let the
callers do this once the need arises.
Also do not touch cpacf_kma(): this wrapper does not handle cc 1 and
cc2 at the moment and has to be reworked.
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
v2: https://lore.kernel.org/all/20260807122132.3592583-1-iii@linux.ibm.com/
v2 -> v3: Drop cpacf_kma() change, add R-b (Harald).
v1: https://lore.kernel.org/linux-s390/20260806190223.3292580-1-iii@linux.ibm.com/
v1 -> v2: Unpoison outputs of more instructions (Sashiko).
arch/s390/include/asm/cpacf.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h
index a83683169d98d..6174552d856dc 100644
--- a/arch/s390/include/asm/cpacf.h
+++ b/arch/s390/include/asm/cpacf.h
@@ -301,6 +301,7 @@ static __always_inline void __cpacf_query(unsigned int opcode,
cpacf_mask_t *mask)
{
__cpacf_query_insn(opcode, mask, CPACF_FC_QUERY);
+ kmsan_unpoison_memory(mask, sizeof(*mask));
}
static __always_inline int __cpacf_check_opcode(unsigned int opcode)
@@ -370,6 +371,7 @@ static __always_inline int cpacf_query_func(unsigned int opcode,
static __always_inline void __cpacf_qai(unsigned int opcode, cpacf_qai_t *qai)
{
__cpacf_query_insn(opcode, qai, CPACF_FC_QUERY_AUTH_INFO);
+ kmsan_unpoison_memory(qai, sizeof(*qai));
}
/**
@@ -422,6 +424,7 @@ static inline int cpacf_km(unsigned long func, void *param,
[opc] "i" (CPACF_KM)
: "cc", "memory", "0", "1");
+ kmsan_unpoison_memory(dest, src_len - s.odd);
return src_len - s.odd;
}
@@ -454,6 +457,7 @@ static inline int cpacf_kmc(unsigned long func, void *param,
[opc] "i" (CPACF_KMC)
: "cc", "memory", "0", "1");
+ kmsan_unpoison_memory(dest, src_len - s.odd);
return src_len - s.odd;
}
@@ -587,6 +591,7 @@ static inline int cpacf_kmctr(unsigned long func, void *param, u8 *dest,
[opc] "i" (CPACF_KMCTR)
: "cc", "memory", "0", "1");
+ kmsan_unpoison_memory(dest, src_len - s.odd);
return src_len - s.odd;
}
@@ -619,6 +624,7 @@ static inline void cpacf_prno(unsigned long func, void *param,
: [fc] "d" (func), [pba] "d" ((unsigned long)param),
[seed] "d" (s.pair), [opc] "i" (CPACF_PRNO)
: "cc", "memory", "0", "1");
+ kmsan_unpoison_memory(dest, dest_len);
}
/**
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] s390/cpacf: Unpoison instruction results
2026-08-14 12:15 [PATCH v3] s390/cpacf: Unpoison instruction results Ilya Leoshkevich
@ 2026-08-19 22:14 ` Vasily Gorbik
0 siblings, 0 replies; 2+ messages in thread
From: Vasily Gorbik @ 2026-08-19 22:14 UTC (permalink / raw)
To: Ilya Leoshkevich
Cc: Harald Freudenberger, Holger Dengler, Heiko Carstens,
Alexander Gordeev, linux-s390, linux-kernel
On Fri, Aug 14, 2026 at 02:15:25PM +0200, Ilya Leoshkevich wrote:
> Stop KMSAN from complaining about CPACF outputs being uninitialized.
>
> Do not unpoison variable-length parameter blocks: mapping function
> codes (like CPACF_KIMD_SHA_256) to lengths will be ugly. So let the
> callers do this once the need arises.
>
> Also do not touch cpacf_kma(): this wrapper does not handle cc 1 and
> cc2 at the moment and has to be reworked.
>
> Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>
> v2: https://lore.kernel.org/all/20260807122132.3592583-1-iii@linux.ibm.com/
> v2 -> v3: Drop cpacf_kma() change, add R-b (Harald).
>
> v1: https://lore.kernel.org/linux-s390/20260806190223.3292580-1-iii@linux.ibm.com/
> v1 -> v2: Unpoison outputs of more instructions (Sashiko).
>
> arch/s390/include/asm/cpacf.h | 6 ++++++
> 1 file changed, 6 insertions(+)
Applied, thank you!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-19 22:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 12:15 [PATCH v3] s390/cpacf: Unpoison instruction results Ilya Leoshkevich
2026-08-19 22:14 ` Vasily Gorbik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox