Bug 20222

Summary: remap_file_pages fails on O_RDONLY file descriptor
Product: Memory Management Reporter: Christopher Head (bugs)
Component: OtherAssignee: Sergey A. Murylev (SergeyMurylev)
Status: RESOLVED CODE_FIX    
Severity: normal CC: SergeyMurylev
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.35 Subsystem:
Regression: No Bisected commit-id:
Attachments: A test program demonstrating the bug
Bug fix

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.