Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pagecache: fix on-demand mapping of evicted pages #2016

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

francescolavra
Copy link
Member

When a page fault occurs on a file-backed mapping for a page that was previously in the page cache but has later been evicted, the fault handler calls pagecache_map_page_if_filled(), which should return false because the newly re-allocated page has not been filled yet. Commit 132a832 introduced a regression which causes pagecache_map_page_if_filled() to return true instead; this leads to page cache contents inconsistent with file contents and erroneous data accessed by the user program via the file-backed mapping.
This change fixes the above issue by amending the touch_or_fill_page_nodelocked() function so that it returns false when the relevant page is in the ALLOC state.

When a page fault occurs on a file-backed mapping for a page that
was previously in the page cache but has later been evicted, the
fault handler calls pagecache_map_page_if_filled(), which should
return `false` because the newly re-allocated page has not been
filled yet. Commit 132a832
introduced a regression which causes pagecache_map_page_if_filled()
to return `true` instead; this leads to page cache contents
inconsistent with file contents and erroneous data accessed by the
user program via the file-backed mapping.
This change fixes the above issue by amending the
touch_or_fill_page_nodelocked() function so that it returns `false`
when the relevant page is in the ALLOC state.
@francescolavra francescolavra merged commit fd452d8 into master Apr 17, 2024
5 checks passed
@francescolavra francescolavra deleted the fix/pagecache branch April 17, 2024 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants