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: <20090204171639.ECCE.KOSAKI.MOTOHIRO@jp.fujitsu.com>
Date:	Wed,  4 Feb 2009 19:28:19 +0900 (JST)
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	MinChan Kim <minchan.kim@...il.com>
Cc:	kosaki.motohiro@...fujitsu.com,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux mm <linux-mm@...ck.org>,
	linux kernel <linux-kernel@...r.kernel.org>,
	Nick Piggin <npiggin@...e.de>, Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH v2] fix mlocked page counter mistmatch

> With '29-rc3-git5', I found,
> 
> static int try_to_mlock_page(struct page *page, struct vm_area_struct *vma)
> {
>   int mlocked = 0; 
> 
>   if (down_read_trylock(&vma->vm_mm->mmap_sem)) {
>     if (vma->vm_flags & VM_LOCKED) {
>       mlock_vma_page(page);
>       mlocked++;  /* really mlocked the page */
>     }    
>     up_read(&vma->vm_mm->mmap_sem);
>   }
>   return mlocked;
> }
> 
> It still try to downgrade mmap_sem.
> Do I miss something ?

sorry, I misunderstood your "downgrade". I said linus removed downgrade_write(&mma_sem).

Now, I understand this issue perfectly. I agree you and lee-san's fix is correct.
	Acked-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>


and, I think current try_to_mlock_page() is correct. no need change.
Why?

1. Generally, mmap_sem holding is necessary when vma->vm_flags accessed.
   that's vma's basic rule.
2. However, try_to_unmap_one() doesn't held mamp_sem. but that's ok.
   it often get incorrect result. but caller consider incorrect value safe.
3. try_to_mlock_page() need mmap_sem because it obey rule (1).
4. in try_to_mlock_page(), if down_read_trylock() is failure, 
   we can't move the page to unevictable list. but that's ok.
   the page in evictable list is periodically try to reclaim. and
   be called try_to_unmap().
   try_to_unmap() (and its caller) also move the unevictable page to unevictable list.
   Therefore, in long term view, the page leak is not happend.

this explanation is enough?

thanks.


--
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