mm/swapfile: fix wrong swap entry type for hwpoisoned swapcache page
authorMiaohe Lin <linmiaohe@huawei.com>
Thu, 27 Jul 2023 11:56:40 +0000 (19:56 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 4 Aug 2023 20:03:40 +0000 (13:03 -0700)
commitf985fc322063c73916a0d5b6b3fcc6db2ba5792c
tree04b45fdbe8fbccb476d9cd52e06b50bd56fddcc4
parentcac7ea57a06016e4914848b707477fb07ee4ae1c
mm/swapfile: fix wrong swap entry type for hwpoisoned swapcache page

Patch series "A few fixup patches for mm", v2.

This series contains a few fixup patches to fix potential unexpected
return value, fix wrong swap entry type for hwpoisoned swapcache page and
so on.  More details can be found in the respective changelogs.

This patch (of 3):

Hwpoisoned dirty swap cache page is kept in the swap cache and there's
simple interception code in do_swap_page() to catch it.  But when trying
to swapoff, unuse_pte() will wrongly install a general sense of "future
accesses are invalid" swap entry for hwpoisoned swap cache page due to
unaware of such type of page.  The user will receive SIGBUS signal without
expected BUS_MCEERR_AR payload.  BTW, typo 'hwposioned' is fixed.

Link: https://lkml.kernel.org/r/20230727115643.639741-1-linmiaohe@huawei.com
Link: https://lkml.kernel.org/r/20230727115643.639741-2-linmiaohe@huawei.com
Fixes: 6b970599e807 ("mm: hwpoison: support recovery from ksm_might_need_to_copy()")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/ksm.c
mm/swapfile.c