Re: [PATCH] mm: swapfile: avoid split_swap_cluster() NULL pointer dereference

From: Huang, Ying
Date: Thu Sep 24 2020 - 23:23:06 EST


Rafael Aquini <aquini@xxxxxxxxxx> writes:
>> Or, can you help to run the test with a debug kernel based on upstream
>> kernel. I can provide some debug patch.
>>
>
> Sure, I can set your patches to run with the test cases we have that tend to
> reproduce the issue with some degree of success.

Thanks!

I found a race condition. During THP splitting, "head" may be unlocked
before calling split_swap_cluster(), because head != page during
deferred splitting. So we should call split_swap_cluster() before
unlocking. The debug patch to do that is as below. Can you help to
test it?

Best Regards,
Huang, Ying

------------------------8<----------------------------