Skip to content

4.14 backports of fixes for "CoW after fork() issue"

Suren Baghdasaryan linux-mm lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 20 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5mm: reuse only-pte-mapped KSM page in do_wp_page()include/linux/ksm.h mm/ksm.c mm/memory.c+49 -42 replies
2/5mm: do_wp_page() simplificationmm/memory.c+17 -410 replies
3/5mm: fix misplaced unlock_page in do_wp_page()mm/memory.c+1 -10 replies
4/5userfaultfd: wp: add helper for writeprotect checkinclude/linux/userfaultfd_k.h+10 -00 replies
5/5mm/userfaultfd: fix memory corruption due to writeprotectmm/memory.c+8 -00 replies

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by.

PatchYang ShiGerald SchaeferJerome GlisseMike RapoportPeter Xu
1/5R-b
2/5
3/5Bisected-and-analyzed-by T-b
4/5R-b R-b
5/5R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v1 thread

Cover letter [PATCH 0/5] 4.14 backports of fixes for "CoW after fork() issue"

We received a report that the copy-on-write issue repored by Jann Horn in
https://bugs.chromium.org/p/project-zero/issues/detail?id=2045 is still reproducible on 4.14 and 4.19 kernels (the first issue with the reproducer coded in vmsplice.c). I confirmed this and also that the issue was not reproducible with 5.10 kernel. I tracked the fix to the following patch introduced in 5.9 which changes the do_wp_page() logic:

09854ba94c6a 'mm: do_wp_page() simplification'

I backported this patch (#2 in the series) along with 2 prerequisite patches (#1 and #4) that keep the backports clean and two followup fixes to the main patch (#3 and #5). I had to skip the following fix:

feb889fb40fa 'mm: don't put pinned pages into the swap cache'

because it uses page_maybe_dma_pinned() which does not exists in earlier kernels. Because pin_user_pages() does not exist there as well, I *think* we can safely skip this fix on older kernels, but I would appreciate if someone could confirm that claim.

The patchset cleanly applies over: stable linux-4.14.y, tag: v4.14.228

Note: 4.14 and 4.19 backports are very similar, so while I backported only to these two versions I think backports for other versions can be done easily.

Kirill Tkhai (1):
mm: reuse only-pte-mapped KSM page in do_wp_page()

Linus Torvalds (2):
mm: do_wp_page() simplification
mm: fix misplaced unlock_page in do_wp_page()

Nadav Amit (1):
mm/userfaultfd: fix memory corruption due to writeprotect

Shaohua Li (1):
userfaultfd: wp: add helper for writeprotect check

 include/linux/ksm.h           |  7 ++++
 include/linux/userfaultfd_k.h | 10 ++++++
 mm/ksm.c                      | 30 ++++++++++++++++--
 mm/memory.c                   | 60 ++++++++++++++++-------------------
 4 files changed, 73 insertions(+), 34 deletions(-)
Signature · 1 line
2.31.0.291.g576ba9dcdaf-goog