Bug 20222
Summary: | remap_file_pages fails on O_RDONLY file descriptor | ||
---|---|---|---|
Product: | Memory Management | Reporter: | Christopher Head (bugs) |
Component: | Other | Assignee: | 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 |
Created attachment 103261 [details]
Bug fix
Why is this resolved? 4.14.83 still has the same problem. |
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!