linux-stable/include
Naoya Horiguchi 6da6b1d4a7 mm/hwpoison: convert TTU_IGNORE_HWPOISON to TTU_HWPOISON
After a memory error happens on a clean folio, a process unexpectedly
receives SIGBUS when it accesses the error page.  This SIGBUS killing is
pointless and simply degrades the level of RAS of the system, because the
clean folio can be dropped without any data lost on memory error handling
as we do for a clean pagecache.

When memory_failure() is called on a clean folio, try_to_unmap() is called
twice (one from split_huge_page() and one from hwpoison_user_mappings()). 
The root cause of the issue is that pte conversion to hwpoisoned entry is
now done in the first call of try_to_unmap() because PageHWPoison is
already set at this point, while it's actually expected to be done in the
second call.  This behavior disturbs the error handling operation like
removing pagecache, which results in the malfunction described above.

So convert TTU_IGNORE_HWPOISON into TTU_HWPOISON and set TTU_HWPOISON only
when we really intend to convert pte to hwpoison entry.  This can prevent
other callers of try_to_unmap() from accidentally converting to hwpoison
entries.

Link: https://lkml.kernel.org/r/20230221085905.1465385-1-naoya.horiguchi@linux.dev
Fixes: a42634a6c0 ("readahead: Use a folio in read_pages()")
Signed-off-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-02-27 17:00:14 -08:00
..
acpi pci-v6.3-changes 2023-02-24 16:51:40 -08:00
asm-generic Driver core changes for 6.3-rc1 2023-02-24 12:58:55 -08:00
clocksource
crypto
drm Driver core changes for 6.3-rc1 2023-02-24 12:58:55 -08:00
dt-bindings We have one small patch to the clk core this time around. It fixes a corner 2023-02-25 15:16:23 -08:00
keys
kunit
kvm KVM/riscv changes for 6.3 2023-02-15 12:33:28 -05:00
linux mm/hwpoison: convert TTU_IGNORE_HWPOISON to TTU_HWPOISON 2023-02-27 17:00:14 -08:00
math-emu
media USB / Thunderbolt driver changes for 6.3-rc1 2023-02-24 12:07:00 -08:00
memory
misc
net page_pool: add a comment explaining the fragment counter usage 2023-02-21 09:15:39 -08:00
pcmcia
ras
rdma
rv
scsi SCSI misc on 20230222 2023-02-22 13:41:41 -08:00
soc
sound Driver core changes for 6.3-rc1 2023-02-24 12:58:55 -08:00
target
trace cxl for v6.3 2023-02-25 09:19:23 -08:00
uapi VFIO updates for v6.3-rc1 2023-02-25 11:52:57 -08:00
ufs SCSI misc on 20230222 2023-02-22 13:41:41 -08:00
vdso
video
xen Driver core changes for 6.3-rc1 2023-02-24 12:58:55 -08:00