Re: [PATCH RFC V2 12/17] memremap: Add zone device access protection

From: Peter Zijlstra
Date: Fri Jul 17 2020 - 05:20:27 EST


On Fri, Jul 17, 2020 at 12:20:51AM -0700, ira.weiny@xxxxxxxxx wrote:
> From: Ira Weiny <ira.weiny@xxxxxxxxx>
>
> Device managed memory exposes itself to the kernel direct map which
> allows stray pointers to access these device memories.
>
> Stray pointers to normal memory may result in a crash or other
> undesirable behavior which, while unfortunate, are usually recoverable
> with a reboot. Stray writes to areas such as non-volatile memory are
> permanent in nature and thus are more likely to result in permanent user
> data loss vs a stray write to other memory areas

> + pks_update_protection(dev_page_pkey, PKEY_DISABLE_ACCESS);

So on the one hand you talk about the problem of stray writes, but then
you disable all access.