lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 30 Jan 2018 14:12:28 -0500
From:   "Zi Yan" <zi.yan@...rutgers.edu>
To:     "Michal Hocko" <mhocko@...nel.org>
Cc:     "Andrew Morton" <akpm@...ux-foundation.org>,
        "Kirill A . Shutemov" <kirill@...temov.name>,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        "Hugh Dickins" <hughd@...gle.com>
Subject: Re: [PATCH] Lock mmap_sem when calling migrate_pages() in
 do_move_pages_to_node()

On 30 Jan 2018, at 11:10, Michal Hocko wrote:

> On Tue 30-01-18 10:52:58, Zi Yan wrote:
>>
>>
>> Michal Hocko wrote:
>>> On Mon 29-01-18 22:00:11, Zi Yan wrote:
>>>> From: Zi Yan <zi.yan@...rutgers.edu>
>>>>
>>>> migrate_pages() requires at least down_read(mmap_sem) to protect
>>>> related page tables and VMAs from changing. Let's do it in
>>>> do_page_moves() for both do_move_pages_to_node() and
>>>> add_page_for_migration().
>>>>
>>>> Also add this lock requirement in the comment of migrate_pages().
>>>
>>> This doesn't make much sense to me, to be honest. We are holding
>>> mmap_sem for _read_ so we allow parallel updates like page faults
>>> or unmaps. Therefore we are isolating pages prior to the migration.
>>>
>>> The sole purpose of the mmap_sem in add_page_for_migration is to protect
>>> from vma going away _while_ need it to get the proper page.
>>
>> Then, I am wondering why we are holding mmap_sem when calling
>> migrate_pages() in existing code.
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Felixir.free-electrons.com%2Flinux%2Flatest%2Fsource%2Fmm%2Fmigrate.c%23L1576&data=02%7C01%7Czi.yan%40cs.rutgers.edu%7C855d86d83cff4669d25f08d567fbfb8d%7Cb92d2b234d35447093ff69aca6632ffe%7C1%7C0%7C636529254319323899&sdata=Ba8F7IHIjxDRV%2FeGg7883wlRBmDHQW6pbZubAWZDNLs%3D&reserved=0
>
> You mean in the original code? I strongly suspect this was to not take
> it for each page.

Right. The original code gathers 169 pages, whose information (struct page_to_node, 24bytes)
fits into a 4KB page, then migrates them at a time. So mmap_sem is not held for long
in the original code, because of this design.

I think the question is whether we need to hold mmap_sem for migrate_pages(). Hugh
also agrees it is not necessary on a separate email. But it is held in the original code.

--
Best Regards
Yan Zi

Download attachment "signature.asc" of type "application/pgp-signature" (497 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ