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]
Message-ID: <5A70959C.9000004@cs.rutgers.edu>
Date:   Tue, 30 Jan 2018 10:56:12 -0500
From:   Zi Yan <zi.yan@...rutgers.edu>
To:     Hugh Dickins <hughd@...gle.com>
CC:     Zi Yan <zi.yan@...t.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Michal Hocko <mhocko@...nel.org>,
        "Kirill A . Shutemov" <kirill@...temov.name>,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()



Hugh Dickins wrote:
> On Mon, 29 Jan 2018, 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
> 
> Page tables are protected by their locks.  VMAs may change while
> migration is active on them, but does that need locking against?
> 
>> 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().
>>
>> Signed-off-by: Zi Yan <zi.yan@...rutgers.edu>
>> ---
>>  mm/migrate.c | 13 +++++++++++--
>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> index 5d0dc7b85f90..52d029953c32 100644
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -1354,6 +1354,9 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
>>   * or free list only if ret != 0.
>>   *
>>   * Returns the number of pages that were not migrated, or an error code.
>> + *
>> + * The caller must hold at least down_read(mmap_sem) for to-be-migrated pages
>> + * to protect related page tables and VMAs from changing.
> 
> I have not been keeping up with Michal's recent migration changes,
> but migrate_pages() never used to need mmap_sem held (despite being
> called with an mmap_sem held from some of its callsites), and it
> would be a backward step to require that now.
> 
> There is not even an mm argument to migrate_pages(), so which
> mm->mmap_sem do you think would be required for it?  There may be
> particular cases in which it is required (when the new_page function
> involves the old_page's vma - is that so below?), but in general not.

mmap_sem is held during migrate_pages() in current implementation.
http://elixir.free-electrons.com/linux/latest/source/mm/migrate.c#L1576


-- 
Best Regards,
Yan Zi


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ