From nobody Sat Oct 25 21:42:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521545781318902.6461786322109; Tue, 20 Mar 2018 04:36:21 -0700 (PDT) Received: from localhost ([::1]:47536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyFYy-0004uZ-5Y for importer@patchew.org; Tue, 20 Mar 2018 07:36:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyFY5-0004ba-0U for qemu-devel@nongnu.org; Tue, 20 Mar 2018 07:35:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyFY1-0005O5-HC for qemu-devel@nongnu.org; Tue, 20 Mar 2018 07:35:24 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:48733) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyFY1-0005C0-8l for qemu-devel@nongnu.org; Tue, 20 Mar 2018 07:35:21 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 796F7215CF; Tue, 20 Mar 2018 07:35:18 -0400 (EDT) Received: from web4 ([10.202.2.214]) by compute1.internal (MEProxy); Tue, 20 Mar 2018 07:35:18 -0400 Received: by mailuser.nyi.internal (Postfix, from userid 99) id 4DFE3BA43B; Tue, 20 Mar 2018 07:35:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=artemis.re; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=nK/X/5ISnaw75i3SofRmsnfBJer8h8vPBKIKSSmkuSU=; b=XgS/eJ24 Btl+F+gL/omQ7KNCdFNQyeXVuIrH1qwV6Z+zPEjDuLmDyjKtBZnTrBqCWvcenmGg rR9LrskycEmlN0FYnA/7n5LJNj065OZViMETYB87OHyMtOyNhzBWWN8bzZuM5Hif UFdFyortM2HilQV/Q9ATWyfA7/PN/cgbdMDI+l/rIIDC6JwqMEWj54pzEeQt6Pht cuxUddDWDPw98GwTzG0/9dShC1IZxPm17vOe2i56GVwVXQya9X3pCY0SimZ3aBqf Eo5u5NpmdvXZhl6PcFNuPdcOb4cL3JyInk40fiweAwO2GUkfS1KoNY9OjsG9l5O+ rppV05mKL+dZhg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=nK/X/5ISnaw75i3SofRmsnfBJer8h 8vPBKIKSSmkuSU=; b=fPlt9iPXgvgT/nDKxVGwnXmbHAHuus/TbB7aHNj7+RM6A 5NkybmP6ZJQDf3If1NNptC3737GPHtujuCZT+lem67decl/b38cNnM0me/2D74ZQ cATPbcv6ZqvUIdPx242Bnw7qMX7xDN0Nm5EDL+i7xqFFP0KO2kaQurjhtd1nEpGQ JjaQrC3+dsTJ21gIaXz+u91diZQQul7H5NNvQFgT/si+xJDTdxawG4a2g/WoySBc XaU5HcshFQZY6CnDD79U4cFgVY7ohq+QFQLAuR26nCKoAKX28jew2fxktmQxdLrx IEaLtUxNj9zXui5UeNzKAiWGgsSD4aiV1d6pDNxdw== X-ME-Sender: Message-Id: <1521545718.1125216.1309456936.3F023B51@webmail.messagingengine.com> From: Artemis Tosini To: qemu-devel@nongnu.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-5ce6c4ba Date: Tue, 20 Mar 2018 07:35:18 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.29 Subject: [Qemu-devel] [PATCH] nvdimm: ensure that dsm memory is read in nvdimm_dsm_write X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jim@groklearning.com, xiaoguangrong.eric@gmail.com, mst@redhat.com, stefanha@gmail.com, joel@jms.id.au, imammedo@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 This patch ensures that the client OS does not cause the host to read inval= id memory from the NVDIMM DSM. It is not tested, since the Linux NVDIMM dri= ver will not cause an invalid memory read. This patch is for my outreachy assignment, and is my first open source patc= h. From bcb717b761ac62adeda145e895f92e4bde1003af Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Sat, 10 Mar 2018 20:38:07 +0000 Subject: [PATCH] nvdimm: ensure that dsm memory is read in nvdimm_dsm_write Signed-off-by: Artemis Tosini --- hw/acpi/nvdimm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 59d6e4254c..67dda723a7 100644 --- a/hw/acpi/nvdimm.c +++ b/hw/acpi/nvdimm.c @@ -838,7 +838,12 @@ nvdimm_dsm_write(void *opaque, hwaddr addr, uint64_t v= al, unsigned size) * this by copying DSM memory to QEMU local memory. */ in =3D g_new(NvdimmDsmIn, 1); - cpu_physical_memory_read(dsm_mem_addr, in, sizeof(*in)); + if (address_space_read(&address_space_memory, dsm_mem_addr, + MEMTXATTRS_UNSPECIFIED, in, + sizeof(*in)) !=3D MEMTX_OK) { + nvdimm_debug("Failed to read DSM memory"); + goto exit; + } =20 le32_to_cpus(&in->revision); le32_to_cpus(&in->function); --=20 2.16.2