Re: [PATCH V8 44/44] devdax: Enable stray access protection

Dan Williams
2022-02-04T21:12:50Z

On Thu, Jan 27, 2022 at 9:55 AM <ira.weiny@intel.com> wrote:
>
> From: Ira Weiny <ira.weiny@intel.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@intel.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;

Looks good.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>