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: <52832724.1090000@asianux.com>
Date:	Wed, 13 Nov 2013 15:15:48 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	Hugh Dickins <hughd@...gle.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] mm: revert mremap pud_free anti-fix

On 10/15/2013 07:46 PM, Chen Gang wrote:
> On 10/15/2013 06:34 PM, Hugh Dickins wrote:
>> > Revert 1ecfd533f4c5 ("mm/mremap.c: call pud_free() after fail calling
>> > pmd_alloc()").  The original code was correct: pud_alloc(), pmd_alloc(),
>> > pte_alloc_map() ensure that the pud, pmd, pt is already allocated, and
>> > seldom do they need to allocate; on failure, upper levels are freed if
>> > appropriate by the subsequent do_munmap().  Whereas 1ecfd533f4c5 did an
>> > unconditional pud_free() of a most-likely still-in-use pud: saved only
>> > by the near-impossiblity of pmd_alloc() failing.
>> > 
> What you said above sounds reasonable to me,  but better to provide the
> information below:
> 
>  - pud_free() for pgd_alloc() in "arch/arm/mm/pgd.c".
> 

It is correct, it is for 'new_pgd' which not come from 'mm'.

>  - pud_free() for init_stub_pte() in "arch/um/kernel/skas/mmu.c".
> 

For me, it need improvement, I have sent related patch for it.

>  - more details about do_munmap(), (e.g. do it need mm->page_table_lock)
>    or more details about the demo "most-likely still-in-use pud ...".
> 

According to "Documentation/vm/locking", 'mm->page_table_lock' is for
using vma list, so not need it when its related vmas are detached from
using vma list.

The related work flow:

  do_munmap()->
    detach_vmas_to_be_unmapped(); /* so not need mm->page_table_lock */
    unmap_region() ->
      free_pgtables() ->
        free_pgd_range() ->
          free_pud_range() ->
            free_pmd_range() ->
              free_pte_range() ->
                pmd_clear();
                pte_free_tlb();
              pud_clear();
              pmd_free_tlb();
            pgd_clear();
            pud_free_tlb();


Thanks.

> 
> Hmm... I am not quite sure about the 3 things, and I will/should
> continue analysing/learning about them, but better to get your reply. :-)


-- 
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ