lkml.org 
[lkml]   [2023]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] mm/swapfile: fix wrong swap entry type for hwpoisoned swapcache page
On Sat, Jul 15, 2023 at 11:17:26AM +0800, Miaohe Lin wrote:
> 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.

Have you observed this, or do you just think it's true?

> +++ b/mm/swapfile.c
> @@ -1767,7 +1767,8 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd,
> swp_entry_t swp_entry;
>
> dec_mm_counter(vma->vm_mm, MM_SWAPENTS);
> - if (hwposioned) {
> + /* Hwpoisoned swapcache page is also !PageUptodate. */
> + if (hwposioned || PageHWPoison(page)) {

This line makes no sense to me. How do we get here with PageHWPoison()
being true and hwposioned being false?

> swp_entry = make_hwpoison_entry(swapcache);
> page = swapcache;
> } else {
> --
> 2.33.0
>
>

\
 
 \ /
  Last update: 2023-07-16 20:52    [W:0.168 / U:1.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site