From: Nicholas Miehlbradt <nicholas@linux.ibm.com>
To: glider@google.com, elver@google.com, dvyukov@google.com,
akpm@linux-foundation.org, mpe@ellerman.id.au, npiggin@gmail.com,
christophe.leroy@csgroup.eu
Cc: linux-mm@kvack.org, kasan-dev@googlegroups.com,
iii@linux.ibm.com, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org,
Nicholas Miehlbradt <nicholas@linux.ibm.com>
Subject: [PATCH 05/13] powerpc: Unpoison buffers populated by hcalls
Date: Thu, 14 Dec 2023 05:55:31 +0000 [thread overview]
Message-ID: <20231214055539.9420-6-nicholas@linux.ibm.com> (raw)
In-Reply-To: <20231214055539.9420-1-nicholas@linux.ibm.com>
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@linux.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
next prev parent reply other threads:[~2023-12-14 5:57 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 5:55 [PATCH 00/13] kmsan: Enable on powerpc Nicholas Miehlbradt
2023-12-14 5:55 ` Nicholas Miehlbradt [this message]
2023-12-14 5:55 ` [PATCH 07/13] powerpc/kprobes: Unpoison instruction in kprobe struct Nicholas Miehlbradt
2023-12-15 7:51 ` Naveen N Rao
2023-12-14 5:55 ` [PATCH 08/13] powerpc: Unpoison pt_regs Nicholas Miehlbradt
2023-12-14 5:55 ` [PATCH 09/13] powerpc: Disable KMSAN checks on functions which walk the stack Nicholas Miehlbradt
2023-12-14 9:00 ` Christophe Leroy
2024-01-10 4:16 ` Nicholas Miehlbradt
2023-12-15 9:02 ` Aneesh Kumar K.V
2023-12-14 5:55 ` [PATCH 10/13] powerpc: Define KMSAN metadata address ranges for vmalloc and ioremap Nicholas Miehlbradt
2023-12-14 9:17 ` Christophe Leroy
2024-01-10 3:54 ` Nicholas Miehlbradt
2023-12-15 9:27 ` Aneesh Kumar K.V
2023-12-14 5:55 ` [PATCH 11/13] powerpc: Implement architecture specific KMSAN interface Nicholas Miehlbradt
2023-12-14 9:20 ` Christophe Leroy
2023-12-14 5:55 ` [PATCH 12/13] powerpc/string: Add KMSAN support Nicholas Miehlbradt
2023-12-14 9:25 ` Christophe Leroy
2024-01-10 4:09 ` Nicholas Miehlbradt
2023-12-14 5:55 ` [PATCH 13/13] powerpc: Enable KMSAN on powerpc Nicholas Miehlbradt
2023-12-14 9:27 ` Christophe Leroy
[not found] ` <20231214055539.9420-3-nicholas@linux.ibm.com>
2023-12-14 8:36 ` [PATCH 02/13] hvc: Fix use of uninitialized array in udbg_hvc_putc Christophe Leroy
2023-12-21 12:09 ` Michael Ellerman
[not found] ` <20231214055539.9420-5-nicholas@linux.ibm.com>
2023-12-14 8:42 ` [PATCH 04/13] powerpc: Disable CONFIG_DCACHE_WORD_ACCESS when KMSAN is enabled Christophe Leroy
[not found] ` <20231214055539.9420-2-nicholas@linux.ibm.com>
2024-02-19 19:37 ` [PATCH 01/13] kmsan: Export kmsan_handle_dma Christophe Leroy
2024-02-20 6:39 ` [PATCH 00/13] kmsan: Enable on powerpc Christophe Leroy
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=20231214055539.9420-6-nicholas@linux.ibm.com \
--to=nicholas@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=christophe.leroy@csgroup.eu \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=iii@linux.ibm.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox