]> Git Repo - linux.git/commit
mm/hugetlb: fix cow where page writtable in child
authorPeter Xu <[email protected]>
Sat, 15 May 2021 00:27:07 +0000 (17:27 -0700)
committerLinus Torvalds <[email protected]>
Sat, 15 May 2021 02:41:32 +0000 (19:41 -0700)
commit84894e1c42e9f25c17f2888e0c0e1505cb727538
tree8eef1e02cf8d88f9fc40199a1df333c8bb4033d8
parent22247efd822e6d263f3c8bd327f3f769aea9b1d9
mm/hugetlb: fix cow where page writtable in child

When rework early cow of pinned hugetlb pages, we moved huge_ptep_get()
upper but overlooked a side effect that the huge_ptep_get() will fetch the
pte after wr-protection.  After moving it upwards, we need explicit
wr-protect of child pte or we will keep the write bit set in the child
process, which could cause data corrution where the child can write to the
original page directly.

This issue can also be exposed by "memfd_test hugetlbfs" kselftest.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: 4eae4efa2c299 ("hugetlb: do early cow when page pinned on src mm")
Signed-off-by: Peter Xu <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Joel Fernandes (Google) <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/hugetlb.c
This page took 0.039659 seconds and 4 git commands to generate.