Hardy: Reinstate ZERO_PAGE optimization in 'get_user_pages()' and fix XIP
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Hardy |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Upstream cherry-pick requested by Kees Cook.
KAMEZAWA Hiroyuki and Oleg Nesterov point out that since the commit 557ed1fa2620dc1
We used to get the ZERO_PAGE when we did the "handle_
In particular, the removal of ZERO_PAGE effectively removed the core file writing optimization where we would skip writing pages that had not been populated at all, and increased memory pressure a lot by allocating all those useless newly zeroed pages.
This reinstates the optimization by making the unmapped PTE case the same as for a non-existent page table, which already did this correctly.
While at it, this also fixes the XIP case for follow_page(), where the caller could not differentiate between the case of a page that simply could not be used (because it had no "struct page" associated with it) and a page that just wasn't mapped.
We do that by simply returning an error pointer for pages that could not be turned into a "struct page *". The error is arbitrarily picked to be EFAULT, since that was what get_user_pages() already used for the equivalent IO-mapped page case.
[ Also removed an impossible test for pte_offset_
Changed in linux: | |
assignee: | nobody → timg-tpi |
importance: | Undecided → Medium |
milestone: | none → ubuntu-8.04.2 |
status: | New → In Progress |
Changed in linux (Ubuntu): | |
assignee: | Tim Gardner (timg-tpi) → nobody |
importance: | Medium → Undecided |
milestone: | ubuntu-8.04.2 → none |
status: | Fix Committed → Invalid |
Changed in linux (Ubuntu Hardy): | |
assignee: | Tim Gardner (timg-tpi) → nobody |
http:// kernel. ubuntu. com/git? p=ubuntu/ ubuntu- hardy.git; a=commit; h=d6292ae514cbb 772805c5b649280 0f4e38272e52