[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220127175505.851391-45-ira.weiny@intel.com>
Date: Thu, 27 Jan 2022 09:55:05 -0800
From: ira.weiny@...el.com
To: Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Dan Williams <dan.j.williams@...el.com>
Cc: Ira Weiny <ira.weiny@...el.com>, Fenghua Yu <fenghua.yu@...el.com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH V8 44/44] devdax: Enable stray access protection
From: Ira Weiny <ira.weiny@...el.com>
Device dax is primarily accessed through user space and kernel access is
controlled through the kmap interfaces.
Now that all valid kernel initiated access to dax devices have been
accounted for, turn on PGMAP_PKEYS_PROTECT for device dax.
Signed-off-by: Ira Weiny <ira.weiny@...el.com>
---
Changes for V8
Rebase to 5.17-rc1
Use pgmap_protection_available()
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 d33a0613ed0c..cee375ef2cac 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -452,6 +452,8 @@ int dev_dax_probe(struct dev_dax *dev_dax)
if (dev_dax->align > PAGE_SIZE)
pgmap->vmemmap_shift =
order_base_2(dev_dax->align >> PAGE_SHIFT);
+ if (pgmap_protection_available())
+ pgmap->flags |= PGMAP_PROTECTION;
addr = devm_memremap_pages(dev, pgmap);
if (IS_ERR(addr))
return PTR_ERR(addr);
--
2.31.1
Powered by blists - more mailing lists