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: <4328e879-f5dc-4b90-89bd-d7969afba350@redhat.com>
Date: Mon, 22 Apr 2024 17:09:26 +0200
From: David Hildenbrand <david@...hat.com>
To: Peter Xu <peterx@...hat.com>, linux-kernel@...r.kernel.org,
 linux-mm@...ck.org
Cc: Nadav Amit <nadav.amit@...il.com>,
 Andrew Morton <akpm@...ux-foundation.org>,
 syzbot+d8426b591c36b21c750e@...kaller.appspotmail.com
Subject: Re: [PATCH] mm/userfaultfd: Reset ptes when close() for wr-protected
 ones

On 22.04.24 15:33, Peter Xu wrote:
> Userfaultfd unregister includes a step to remove wr-protect bits from all
> the relevant pgtable entries, but that only covered an explicit
> UFFDIO_UNREGISTER ioctl, not a close() on the userfaultfd itself.  Cover
> that too.
> 
> Link: https://lore.kernel.org/all/000000000000ca4df20616a0fe16@google.com/
> Analyzed-by: David Hildenbrand <david@...hat.com>
> Reported-by: syzbot+d8426b591c36b21c750e@...kaller.appspotmail.com
> Signed-off-by: Peter Xu <peterx@...hat.com>
> ---
>   fs/userfaultfd.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
> index 3e6ddda6f159..d2c3879745e5 100644
> --- a/fs/userfaultfd.c
> +++ b/fs/userfaultfd.c
> @@ -898,6 +898,10 @@ static int userfaultfd_release(struct inode *inode, struct file *file)
>   			prev = vma;
>   			continue;
>   		}
> +		/* Reset ptes for the whole vma range if wr-protected */
> +		if (userfaultfd_wp(vma))
> +			uffd_wp_range(vma, vma->vm_start,
> +				      vma->vm_end - vma->vm_start, false);
>   		new_flags = vma->vm_flags & ~__VM_UFFD_FLAGS;
>   		vma = vma_modify_flags_uffd(&vmi, prev, vma, vma->vm_start,
>   					    vma->vm_end, new_flags,

LGTM

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

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ