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: <511e07da-9b34-4707-8f5a-f1e534c4445a@redhat.com>
Date: Fri, 12 Jan 2024 09:57:12 +0100
From: David Hildenbrand <david@...hat.com>
To: Suren Baghdasaryan <surenb@...gle.com>, akpm@...ux-foundation.org
Cc: sfr@...b.auug.org.au, peterx@...hat.com, aarcange@...hat.com,
 linux-kernel@...r.kernel.org, linux-mm@...ck.org,
 syzbot+705209281e36404998f6@...kaller.appspotmail.com
Subject: Re: [PATCH 1/1] userfaultfd: avoid huge_zero_page in UFFDIO_MOVE

On 12.01.24 02:39, Suren Baghdasaryan wrote:
> While testing UFFDIO_MOVE ioctl, syzbot triggered VM_BUG_ON_PAGE caused
> by a call to PageAnonExclusive() with a huge_zero_page as a parameter.
> UFFDIO_MOVE does not yet handle zeropages and returns EBUSY when one is
> encountered. Add an early huge_zero_page check in the PMD move path
> to avoid this situation.
> 
> Reported-by: syzbot+705209281e36404998f6@...kaller.appspotmail.com
> Fixes: adef440691ba ("userfaultfd: UFFDIO_MOVE uABI")
> Signed-off-by: Suren Baghdasaryan <surenb@...gle.com>
> ---
> Applies cleanly over linux-next, mm-stable and mm-unstable branches
> 
>   mm/userfaultfd.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
> index 216ab4c8621f..20e3b0d9cf7e 100644
> --- a/mm/userfaultfd.c
> +++ b/mm/userfaultfd.c
> @@ -1393,6 +1393,12 @@ ssize_t move_pages(struct userfaultfd_ctx *ctx, struct mm_struct *mm,
>   				err = -ENOENT;
>   				break;
>   			}
> +			/* Avoid moving zeropages for now */
> +			if (is_huge_zero_pmd(*src_pmd)) {
> +				spin_unlock(ptl);
> +				err = -EBUSY;
> +				break;
> +			}

As an alternative (and more future proof?) just reject anything that is 
not an anon folio as well?

Anyhow, this should handle the issue at hand.

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

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ