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: <0e04877c-5b2d-b810-7464-108e793b84d3@huawei.com>
Date:   Mon, 10 May 2021 14:57:06 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     Hugh Dickins <hughd@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>
CC:     <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>
Subject: Re: [PATCH] ksm: Revert "use GET_KSM_PAGE_NOLOCK to get ksm page in
 remove_rmap_item_from_tree()"

On 2021/5/10 13:59, Hugh Dickins wrote:
> This reverts commit 3e96b6a2e9ad929a3230a22f4d64a74671a0720b.
> General Protection Fault in rmap_walk_ksm() under memory pressure:
> remove_rmap_item_from_tree() needs to take page lock, of course.
> 

I'am really sorry about it! And many thanks for this bugfix!
It seems rmap_walk_ksm() relies on the page lock to protect against
concurrent modifications to that page's node of the stable tree.
Could you please add a comment in remove_rmap_item_from_tree() to
clarify this in case similar trouble again? Many thanks!

> Signed-off-by: Hugh Dickins <hughd@...gle.com>
> ---
> 
>  mm/ksm.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> --- 5.13-rc1/mm/ksm.c	2021-05-09 17:03:44.010422188 -0700
> +++ linux/mm/ksm.c	2021-05-09 22:12:39.403008350 -0700
> @@ -776,11 +776,12 @@ static void remove_rmap_item_from_tree(s
>  		struct page *page;
>  
>  		stable_node = rmap_item->head;
> -		page = get_ksm_page(stable_node, GET_KSM_PAGE_NOLOCK);
> +		page = get_ksm_page(stable_node, GET_KSM_PAGE_LOCK);
>  		if (!page)
>  			goto out;
>  
>  		hlist_del(&rmap_item->hlist);
> +		unlock_page(page);
>  		put_page(page);
>  
>  		if (!hlist_empty(&stable_node->hlist))
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ