[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231214055539.9420-6-nicholas@linux.ibm.com>
Date: Thu, 14 Dec 2023 05:55:31 +0000
From: Nicholas Miehlbradt <nicholas@...ux.ibm.com>
To: glider@...gle.com, elver@...gle.com, dvyukov@...gle.com,
akpm@...ux-foundation.org, mpe@...erman.id.au, npiggin@...il.com,
christophe.leroy@...roup.eu
Cc: linux-mm@...ck.org, kasan-dev@...glegroups.com, iii@...ux.ibm.com,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Nicholas Miehlbradt <nicholas@...ux.ibm.com>
Subject: [PATCH 05/13] powerpc: Unpoison buffers populated by hcalls
plpar_hcall provides to the hypervisor a buffer where return data should be
placed. The hypervisor initializes the buffers which is not visible to
KMSAN so unpoison them manually.
Signed-off-by: Nicholas Miehlbradt <nicholas@...ux.ibm.com>
---
arch/powerpc/platforms/pseries/hvconsole.c | 2 ++
arch/powerpc/sysdev/xive/spapr.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/hvconsole.c b/arch/powerpc/platforms/pseries/hvconsole.c
index 1ac52963e08b..7ad66acd5db8 100644
--- a/arch/powerpc/platforms/pseries/hvconsole.c
+++ b/arch/powerpc/platforms/pseries/hvconsole.c
@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/errno.h>
+#include <linux/kmsan-checks.h>
#include <asm/hvcall.h>
#include <asm/hvconsole.h>
#include <asm/plpar_wrappers.h>
@@ -32,6 +33,7 @@ int hvc_get_chars(uint32_t vtermno, char *buf, int count)
unsigned long *lbuf = (unsigned long *)buf;
ret = plpar_hcall(H_GET_TERM_CHAR, retbuf, vtermno);
+ kmsan_unpoison_memory(retbuf, sizeof(retbuf));
lbuf[0] = be64_to_cpu(retbuf[1]);
lbuf[1] = be64_to_cpu(retbuf[2]);
diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c
index e45419264391..a9f48a336e4d 100644
--- a/arch/powerpc/sysdev/xive/spapr.c
+++ b/arch/powerpc/sysdev/xive/spapr.c
@@ -20,6 +20,7 @@
#include <linux/mm.h>
#include <linux/delay.h>
#include <linux/libfdt.h>
+#include <linux/kmsan-checks.h>
#include <asm/machdep.h>
#include <asm/prom.h>
@@ -191,6 +192,8 @@ static long plpar_int_get_source_info(unsigned long flags,
return rc;
}
+ kmsan_unpoison_memory(retbuf, sizeof(retbuf));
+
*src_flags = retbuf[0];
*eoi_page = retbuf[1];
*trig_page = retbuf[2];
--
2.40.1
Powered by blists - more mailing lists