diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2024-03-24 17:04:47 -0400 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-03-26 11:14:12 -0700 |
commit | 25cd241408a2adc1ed0ebc90ae0793576c111880 (patch) | |
tree | f2a276d3dd6ac5cc48be97e485e0e1ef6b3145f5 /mm/userfaultfd.c | |
parent | 8c864371b2a15a23ce35aa7e2bd241baaad6fbe8 (diff) | |
download | linux-stable-25cd241408a2adc1ed0ebc90ae0793576c111880.tar.gz linux-stable-25cd241408a2adc1ed0ebc90ae0793576c111880.tar.bz2 linux-stable-25cd241408a2adc1ed0ebc90ae0793576c111880.zip |
mm: zswap: fix data loss on SWP_SYNCHRONOUS_IO devices
Zhongkun He reports data corruption when combining zswap with zram.
The issue is the exclusive loads we're doing in zswap. They assume
that all reads are going into the swapcache, which can assume
authoritative ownership of the data and so the zswap copy can go.
However, zram files are marked SWP_SYNCHRONOUS_IO, and faults will try to
bypass the swapcache. This results in an optimistic read of the swap data
into a page that will be dismissed if the fault fails due to races. In
this case, zswap mustn't drop its authoritative copy.
Link: https://lore.kernel.org/all/CACSyD1N+dUvsu8=zV9P691B9bVq33erwOXNTmEaUbi9DrDeJzw@mail.gmail.com/
Fixes: b9c91c43412f ("mm: zswap: support exclusive loads")
Link: https://lkml.kernel.org/r/20240324210447.956973-1-hannes@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reported-by: Zhongkun He <hezhongkun.hzk@bytedance.com>
Tested-by: Zhongkun He <hezhongkun.hzk@bytedance.com>
Acked-by: Yosry Ahmed <yosryahmed@google.com>
Acked-by: Barry Song <baohua@kernel.org>
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Acked-by: Chris Li <chrisl@kernel.org>
Cc: <stable@vger.kernel.org> [6.5+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/userfaultfd.c')
0 files changed, 0 insertions, 0 deletions