Bug 20222 - remap_file_pages fails on O_RDONLY file descriptor
Summary: remap_file_pages fails on O_RDONLY file descriptor
Status: RESOLVED CODE_FIX
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Sergey A. Murylev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-13 02:40 UTC by Christopher Head
Modified: 2018-11-30 16:11 UTC (History)
1 user (show)

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


Attachments
A test program demonstrating the bug (899 bytes, text/plain)
2010-10-13 02:40 UTC, Christopher Head
Details
Bug fix (392 bytes, patch)
2013-06-03 09:56 UTC, Sergey A. Murylev
Details | Diff

Description Christopher Head 2010-10-13 02:40:45 UTC
Created attachment 33412 [details]
A test program demonstrating the bug

If a file is opened with O_RDONLY and then mmap()ed, calling remap_file_pages() on the mapped region fails with EINVAL. The attached test program demonstrates the problem: compile and run it, and it will fail with "remap_file_pages: Invalid argument". Change O_RDONLY in the second open() call to O_RDWR and it will stop failing. Of course, this is not a useful workaround if one doesn't have write access to the target file!
Comment 1 Sergey A. Murylev 2013-06-03 09:56:01 UTC
Created attachment 103261 [details]
Bug fix
Comment 2 Christopher Head 2018-11-30 16:11:42 UTC
Why is this resolved? 4.14.83 still has the same problem.

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