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]
Message-ID: <39cfb01a-88f2-479a-898d-cbcbb869821d@redhat.com>
Date: Fri, 11 Jul 2025 12:50:38 +0200
From: David Hildenbrand <david@...hat.com>
To: "Vishal Moola (Oracle)" <vishal.moola@...il.com>, linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org,
 "Matthew Wilcox (Oracle)" <willy@...radead.org>,
 Jordan Rome <linux@...danrome.com>, Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 2/3] mm/memory.c: Use folios in __access_remote_vm()

On 09.07.25 21:40, Vishal Moola (Oracle) wrote:
> Use kmap_local_folio() instead of kmap_local_page().
> Replaces 2 calls to compound_head() with one.
> 
> This prepares us for the removal of unmap_and_put_page().
> 
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@...il.com>
> ---
>   mm/memory.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index d63f0d5abcc9..3dd6c57e6511 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -6691,6 +6691,7 @@ static int __access_remote_vm(struct mm_struct *mm, unsigned long addr,
>   	while (len) {
>   		int bytes, offset;
>   		void *maddr;
> +		struct folio *folio;
>   		struct vm_area_struct *vma = NULL;
>   		struct page *page = get_user_page_vma_remote(mm, addr,
>   							     gup_flags, &vma);
> @@ -6722,21 +6723,22 @@ static int __access_remote_vm(struct mm_struct *mm, unsigned long addr,
>   			if (bytes <= 0)
>   				break;
>   		} else {
> +			folio = page_folio(page);
>   			bytes = len;
>   			offset = addr & (PAGE_SIZE-1);
>   			if (bytes > PAGE_SIZE-offset)
>   				bytes = PAGE_SIZE-offset;
>   
> -			maddr = kmap_local_page(page);
> +			maddr = kmap_local_folio(folio, folio_page_idx(folio, page) * PAGE_SIZE);
>   			if (write) {
>   				copy_to_user_page(vma, page, addr,
>   						  maddr + offset, buf, bytes);
> -				set_page_dirty_lock(page);
> +				folio_mark_dirty_lock(folio);
>   			} else {
>   				copy_from_user_page(vma, page, addr,
>   						    buf, maddr + offset, bytes);
>   			}
> -			unmap_and_put_page(page, maddr);
> +			folio_release_kmap(folio, maddr);

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

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ