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: <0dc516ab-b2b0-414d-868e-880bd13b5cdd@redhat.com>
Date: Wed, 4 Dec 2024 20:01:48 +0100
From: David Hildenbrand <david@...hat.com>
To: Guillaume Morin <guillaume@...infr.org>, linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, Muchun Song <muchun.song@...ux.dev>,
 Andrew Morton <akpm@...ux-foundation.org>, Peter Xu <peterx@...hat.com>,
 Eric Hagberg <ehagberg@...estreet.com>
Subject: Re: [PATCH v1] hugetlb: support FOLL_FORCE|FOLL_WRITE

On 04.12.24 19:26, Guillaume Morin wrote:

Patch prefix should likely be "mm/hugetlb: ..."

> FOLL_FORCE|FOLL_WRITE has never been properly supported for hugetlb
> mappings.  Since 1d8d14641fd94, we explicitly reject it. However

"Since commit 1d8d14641fd9 ("mm/hugetlb: support write-faults in shared 
mappings") ..."

> running software on hugetlb mappings is a useful optimization.
> Multiple tools allow to use that such as Intel iodlr or
> libhugetlbfs.

It would be better to link to the actual request where people ran into 
that when using PTRACE_POKETEXT

That hugetlb is getting used is rather obvious :)

> 
> Cc: Muchun Song <muchun.song@...ux.dev>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Peter Xu <peterx@...hat.com>
> Cc: David Hildenbrand <david@...hat.com>
> Cc: Eric Hagberg <ehagberg@...estreet.com>
> Signed-off-by: Guillaume Morin <guillaume@...infr.org>
> ---

[...]

>   		delayacct_wpcopy_end();
>   		return 0;
> @@ -5943,7 +5944,8 @@ static vm_fault_t hugetlb_wp(struct folio *pagecache_folio,
>   	spin_lock(vmf->ptl);
>   	vmf->pte = hugetlb_walk(vma, vmf->address, huge_page_size(h));
>   	if (likely(vmf->pte && pte_same(huge_ptep_get(mm, vmf->address, vmf->pte), pte))) {
> -		pte_t newpte = make_huge_pte(vma, &new_folio->page, !unshare);
> +		const bool writable = !unshare && (vma->vm_flags & VM_WRITE);
> +		pte_t newpte = make_huge_pte(vma, &new_folio->page, writable);
>   
>   		/* Break COW or unshare */
>   		huge_ptep_clear_flush(vma, vmf->address, vmf->pte);

After rebasing to [1] this hunk here can likely be dropped. 
make_huge_pte() will perform the VM_WRITE check.


[1] https://lkml.kernel.org/r/20241204153100.1967364-1-david@redhat.com


-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ