[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220419170649.1022246-37-ira.weiny@intel.com>
Date: Tue, 19 Apr 2022 10:06:41 -0700
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>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH V10 36/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.
Reviewed-by: Dan Williams <dan.j.williams@...el.com>
Signed-off-by: Ira Weiny <ira.weiny@...el.com>
---
Changes for V9
Add Review tag
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 5494d745ced5..045854ba3855 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -451,6 +451,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.35.1
Powered by blists - more mailing lists