Bug 209683 - MAP_SHARED_VALIDATE is not supported for anonymous mappings
Summary: MAP_SHARED_VALIDATE is not supported for anonymous mappings
Status: NEW
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Andrew Morton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-14 14:34 UTC by Ian Abbott
Modified: 2020-10-14 14:34 UTC (History)
0 users

See Also:
Kernel Version: 4.15 onwards
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Ian Abbott 2020-10-14 14:34:36 UTC
According to the mmap man page, MAP_SHARED_VALIDATE provides the same behavior as MAP_SHARED except that unknown flags result in an EOPNOTSUPP error. However, the following results in a failed mapping with error EINVAL:

mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED_VALIDATE, -1, 0);

Looking at the code of do_mmap() in "mm/mmap.c", if file is NULL, then -EINVAL is returned if (flags & MAP_TYPE) is neither MAP_SHARED nor MAP_PRIVATE.

Related question on stackoverflow:
https://stackoverflow.com/questions/64354124

Note You need to log in before you can comment on or make changes to this bug.