[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210804043231.2655537-19-ira.weiny@intel.com>
Date: Tue, 3 Aug 2021 21:32:31 -0700
From: ira.weiny@...el.com
To: Dave Hansen <dave.hansen@...ux.intel.com>,
Dan Williams <dan.j.williams@...el.com>
Cc: Ira Weiny <ira.weiny@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, nvdimm@...ts.linux.dev,
linux-mm@...ck.org
Subject: [PATCH V7 18/18] devdax: Enable stray access protection
From: Ira Weiny <ira.weiny@...el.com>
Device dax is primarily accessed through user space. Kernel access is
controlled through the kmap interfaces.
Now that all valid kernel initiated access to dax devices have been
accounted for with pgmap_mk_{readwrite,noaccess}() through kmap, turn
on PGMAP_PKEYS_PROTECT for device dax.
Signed-off-by: Ira Weiny <ira.weiny@...el.com>
---
Changes for V7
Use pgmap_protetion_enabled()
s/PGMAP_PKEYS_PROTECT/PGMAP_PROTECTION/
---
drivers/dax/device.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index dd8222a42808..cdf6ef4c1edb 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -426,6 +426,8 @@ int dev_dax_probe(struct dev_dax *dev_dax)
}
pgmap->type = MEMORY_DEVICE_GENERIC;
+ if (pgmap_protection_enabled())
+ pgmap->flags |= PGMAP_PROTECTION;
addr = devm_memremap_pages(dev, pgmap);
if (IS_ERR(addr))
return PTR_ERR(addr);
--
2.28.0.rc0.12.gb6a658bd00c9
Powered by blists - more mailing lists