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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZouiK8Fm5RGNpwSb@localhost.localdomain>
Date: Mon, 8 Jul 2024 10:24:11 +0200
From: Oscar Salvador <osalvador@...e.de>
To: Miaohe Lin <linmiaohe@...wei.com>
Cc: akpm@...ux-foundation.org, muchun.song@...ux.dev, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/hugetlb: fix potential race in
 __update_and_free_hugetlb_folio()

On Mon, Jul 08, 2024 at 10:51:27AM +0800, Miaohe Lin wrote:
> There is a potential race between __update_and_free_hugetlb_folio() and
> try_memory_failure_hugetlb():
> 
>  CPU1					CPU2
>  __update_and_free_hugetlb_folio	try_memory_failure_hugetlb
> 					 folio_test_hugetlb
> 					  -- It's still hugetlb folio.
>   folio_clear_hugetlb_hwpoison
>   					  spin_lock_irq(&hugetlb_lock);
> 					   __get_huge_page_for_hwpoison
> 					    folio_set_hugetlb_hwpoison
> 					  spin_unlock_irq(&hugetlb_lock);
>   spin_lock_irq(&hugetlb_lock);
>   __folio_clear_hugetlb(folio);
>    -- Hugetlb flag is cleared but too late.
>   spin_unlock_irq(&hugetlb_lock);
> 
> When above race occurs, raw error page info will be leaked. Even worse,
> raw error pages won't have hwpoisoned flag set and hit pcplists/buddy.
> Fix this issue by deferring folio_clear_hugetlb_hwpoison() until
> __folio_clear_hugetlb() is done. So all raw error pages will have
> hwpoisoned flag set.
> 
> Fixes: 32c877191e02 ("hugetlb: do not clear hugetlb dtor until allocating vmemmap")
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> Cc: <stable@...r.kernel.org>

Reviewed-by: Oscar Salvador <osalvador@...e.de>


-- 
Oscar Salvador
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ