Re: [PATCH v2] mm/mremap: Fail map duplication attempts for private mappings
From: Mike Kravetz
Date: Fri Jul 21 2017 - 17:19:29 EST
On 07/21/2017 07:36 AM, Michal Hocko wrote:
> On Thu 20-07-17 13:37:59, Mike Kravetz wrote:
>> mremap will create a 'duplicate' mapping if old_size == 0 is
>> specified. Such duplicate mappings make no sense for private
>> mappings.
>
> sorry for the nit picking but this is not true strictly speaking.
> It makes some sense, arguably (e.g. take an atomic snapshot of the
> mapping). It doesn't make any sense with the _current_ implementation.
>
>> If duplication is attempted for a private mapping,
>> mremap creates a separate private mapping unrelated to the
>> original mapping and makes no modifications to the original.
>> This is contrary to the purpose of mremap which should return
>> a mapping which is in some way related to the original.
>>
>> Therefore, return EINVAL in the case where if an attempt is
>> made to duplicate a private mapping. Also, print a warning
>> message (once) if such an attempt is made.
>>
>> Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
>
> I do not insist on the comment update suggested
> http://lkml.kernel.org/r/20170720082058.GF9058@xxxxxxxxxxxxxx
> but I would appreciate it...
>
> Other than that looks reasonably to me
>
> Acked-by: Michal Hocko <mhocko@xxxxxxxx>
My apologies. I overlooked your comment about the comment when
creating the patch. Below is the patch with commit message and
comment updated.