[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220510061712.GA162496@hori.linux.bs1.fc.nec.co.jp>
Date: Tue, 10 May 2022 06:17:12 +0000
From: HORIGUCHI NAOYA(堀口 直也)
<naoya.horiguchi@....com>
To: Miaohe Lin <linmiaohe@...wei.com>
CC: "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"willy@...radead.org" <willy@...radead.org>,
"vbabka@...e.cz" <vbabka@...e.cz>,
"dhowells@...hat.com" <dhowells@...hat.com>,
"neilb@...e.de" <neilb@...e.de>,
"david@...hat.com" <david@...hat.com>,
"apopple@...dia.com" <apopple@...dia.com>,
"surenb@...gle.com" <surenb@...gle.com>,
"minchan@...nel.org" <minchan@...nel.org>,
"peterx@...hat.com" <peterx@...hat.com>,
"sfr@...b.auug.org.au" <sfr@...b.auug.org.au>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 1/3] mm/swapfile: unuse_pte can map random data if swap
read fails
On Sun, Apr 24, 2022 at 05:11:03PM +0800, Miaohe Lin wrote:
> There is a bug in unuse_pte(): when swap page happens to be unreadable,
> page filled with random data is mapped into user address space. In case
> of error, a special swap entry indicating swap read fails is set to the
> page table. So the swapcache page can be freed and the user won't end up
> with a permanently mounted swap because a sector is bad. And if the page
> is accessed later, the user process will be killed so that corrupted data
> is never consumed. On the other hand, if the page is never accessed, the
> user won't even notice it.
>
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> Acked-by: David Hildenbrand <david@...hat.com>
When I reproduced the issue (generated read error with dm-dust), I saw
infinite loop in the while loop in shmem_unuse_inode() (and this happens
even with this patch). I confirmed that shmem_swapin_page() returns -EIO,
but shmem_unuse_swap_entries() does not return the error to the callers,
so the while loop in shmem_unuse_inode() seems not break.
So maybe you need more code around shmem_unuse_inode() to handle the error?
Thanks,
Naoya Horiguchi
Powered by blists - more mailing lists