2017-11-21 22:36:51

by Zi Yan

[permalink] [raw]
Subject: Re: [PATCH] mm: migrate: fix an incorrect call of prep_transhuge_page()

On 21 Nov 2017, at 17:12, Andrew Morton wrote:

> On Mon, 20 Nov 2017 21:18:55 -0500 Zi Yan <[email protected]> wrote:
>
>> In [1], Andrea reported that during memory hotplug/hot remove
>> prep_transhuge_page() is called incorrectly on non-THP pages for
>> migration, when THP is on but THP migration is not enabled.
>> This leads to a bad state of target pages for migration.
>>
>> This patch fixes it by only calling prep_transhuge_page() when we are
>> certain that the target page is THP.
>
> What are the user-visible effects of the bug?

By inspecting the code, if called on a non-THP, prep_transhuge_page() will
1) change the value of the mapping of (page + 2), since it is used for THP deferred list;
2) change the lru value of (page + 1), since it is used for THP’s dtor.

Both can lead to data corruption of these two pages.


Best Regards,
Yan Zi


Attachments:
signature.asc (569.00 B)
OpenPGP digital signature