diff mbox series

[v3,23/34] s390/cpacf: Unpoison the results of cpacf_trng()

Message ID 20231213233605.661251-24-iii@linux.ibm.com (mailing list archive)
State Handled Elsewhere
Headers show
Series kmsan: Enable on s390 | expand

Commit Message

Ilya Leoshkevich Dec. 13, 2023, 11:24 p.m. UTC
Prevent KMSAN from complaining about buffers filled by cpacf_trng()
being uninitialized.

Tested-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 arch/s390/include/asm/cpacf.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Heiko Carstens Jan. 2, 2024, 2:34 p.m. UTC | #1
On Thu, Dec 14, 2023 at 12:24:43AM +0100, Ilya Leoshkevich wrote:
> Prevent KMSAN from complaining about buffers filled by cpacf_trng()
> being uninitialized.
> 
> Tested-by: Alexander Gordeev <agordeev@linux.ibm.com>
> Reviewed-by: Alexander Potapenko <glider@google.com>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  arch/s390/include/asm/cpacf.h | 3 +++
>  1 file changed, 3 insertions(+)

Acked-by: Heiko Carstens <hca@linux.ibm.com>
diff mbox series

Patch

diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h
index b378e2b57ad8..2bb6b4e7e082 100644
--- a/arch/s390/include/asm/cpacf.h
+++ b/arch/s390/include/asm/cpacf.h
@@ -12,6 +12,7 @@ 
 #define _ASM_S390_CPACF_H
 
 #include <asm/facility.h>
+#include <linux/kmsan-checks.h>
 
 /*
  * Instruction opcodes for the CPACF instructions
@@ -473,6 +474,8 @@  static inline void cpacf_trng(u8 *ucbuf, unsigned long ucbuf_len,
 		: [ucbuf] "+&d" (u.pair), [cbuf] "+&d" (c.pair)
 		: [fc] "K" (CPACF_PRNO_TRNG), [opc] "i" (CPACF_PRNO)
 		: "cc", "memory", "0");
+	kmsan_unpoison_memory(ucbuf, ucbuf_len);
+	kmsan_unpoison_memory(cbuf, cbuf_len);
 }
 
 /**