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] [thread-next>] [day] [month] [year] [list]
Date: Fri, 5 Apr 2024 09:23:01 +0200
From: David Hildenbrand <david@...hat.com>
To: alexs@...nel.org, Matthew Wilcox <willy@...radead.org>,
 Andrea Arcangeli <aarcange@...hat.com>,
 Izik Eidus <izik.eidus@...ellosystems.com>,
 Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org, ryncsn@...il.com
Cc: Hugh Dickins <hughd@...gle.com>, Chris Wright <chrisw@...s-sol.org>
Subject: Re: [PATCH v3 07/14] mm/ksm: use folio in write_protect_page

On 25.03.24 13:48, alexs@...nel.org wrote:
> From: "Alex Shi (tencent)" <alexs@...nel.org>
> 
> Compound page is checked and skipped before write_protect_page() called,
> use folio to save a few compound_head checking.
> 
> Signed-off-by: Alex Shi (tencent) <alexs@...nel.org>
> Cc: Izik Eidus <izik.eidus@...ellosystems.com>
> Cc: Matthew Wilcox <willy@...radead.org>
> Cc: Andrea Arcangeli <aarcange@...hat.com>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: Chris Wright <chrisw@...s-sol.org>
> ---
>   mm/ksm.c | 22 +++++++++++-----------
>   1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 95a487a21eed..5d1f62e7462a 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -1289,22 +1289,22 @@ static u32 calc_checksum(struct page *page)
>   	return checksum;
>   }
>   
> -static int write_protect_page(struct vm_area_struct *vma, struct page *page,
> +static int write_protect_page(struct vm_area_struct *vma, struct folio *folio,
>   			      pte_t *orig_pte)
>   {
>   	struct mm_struct *mm = vma->vm_mm;
> -	DEFINE_PAGE_VMA_WALK(pvmw, page, vma, 0, 0);
> +	DEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, 0, 0);
>   	int swapped;
>   	int err = -EFAULT;
>   	struct mmu_notifier_range range;
>   	bool anon_exclusive;
>   	pte_t entry;
>   
> -	pvmw.address = page_address_in_vma(page, vma);
> +	pvmw.address = page_address_in_vma(&folio->page, vma);
>   	if (pvmw.address == -EFAULT)
>   		goto out;
>   
> -	BUG_ON(PageTransCompound(page));
> +	VM_BUG_ON(folio_test_large(folio));

I suggest

if (WARN_ON_ONCE(folio_test_large(folio)))
	return err;

before the page_address_in_vma() call.


Reviewed-by: David Hildenbrand <david@...hat.com>

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ