Re: [PATCH -mm -V8] mm, swap: fix race between swapoff and some swap operations

From: Huang\, Ying
Date: Tue Feb 26 2019 - 20:13:21 EST


Daniel Jordan <daniel.m.jordan@xxxxxxxxxx> writes:

> On Tue, Feb 26, 2019 at 02:49:05PM +0800, Huang, Ying wrote:
>> Do you have time to take a look at this patch?
>
> Hi Ying, is this handling all places where swapoff might cause a task to read
> invalid data? For example, why don't other reads of swap_map (for example
> swp_swapcount, page_swapcount, swap_entry_free) need to be synchronized like
> this?

I have checked these places. They are safe because there are some locks
(like page lock, page table lock, etc.) held to prevent swapoff. I
found another place in the kernel that is unsafe: the mincore. I have a
patch for that and will post it (in fact again) after this one is
merged.

Best Regards,
Huang, Ying