Re: [PATCH] Using MAP_SHARE_VALIDATE in mmap without fd

From: Nils Hartmann
Date: Thu Mar 16 2023 - 15:16:40 EST


On Thu, Mar 16, 2023 at 04:28:21PM +0100, David Hildenbrand wrote:
> On 10.03.23 18:16, Nils Hartmann wrote:
> > Hey,
> > When used without a file pointer, EINVAL is returned. Is there a reason for this?
>
> You mean, using it with shared anonymous memory? (MAP_SHARED|MAP_ANON)
> I assume you mean "file descriptor" not "file pointer".

Yup thats what I meant.

> The only reason MAP_SHARED_VALIDATE was introduced was due to MAP_SYNC, only
> required for DAX. DAX does not apply to shared anonymous memory.

Yeah I heard about it being introduced with MAP_SYNC.
But since the manpage from mmap specifically says:
'MAP_SHARED_VALIDATE provides the same behaviour as MAP_SHARED',
I didn't think it would make a difference

> I guess nobody cared/cares.
> Question is if we want to update the implementation (there has to be a good
> reason IMHO) or simply update the man page, stating that MAP_SHARED_VALIDATE
> is not supported for MAP_ANON.

The only reason I can come up with, is naming consistency.
But it's really a non-issue und updating the man page is definitly
the saner option.

> --
> Thanks,
>
> David / dhildenb
>

Best Regards,

Nils