From: David Hildenbrand <david@redhat.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
Andrew Morton <akpm@linux-foundation.org>,
John Hubbard <jhubbard@nvidia.com>,
linux-mm@kvack.org, Lorenzo Stoakes <lstoakes@gmail.com>
Cc: syzbot+353c7be4964c6253f24a@syzkaller.appspotmail.com
Subject: Re: [PATCH] mm/gup: Do not return 0 from pin_user_pages_fast() for bad args
Date: Wed, 21 Jun 2023 13:24:14 +0200 [thread overview]
Message-ID: <d86c82d7-2e45-6de8-dcfa-c1dcac06c49a@redhat.com> (raw)
In-Reply-To: <0-v1-3d5ed1f20d50+104-gup_overflow_jgg@nvidia.com>
On 19.06.23 20:27, Jason Gunthorpe wrote:
> These routines are not intended to return zero, the callers cannot do
> anything sane with a 0 return. They should return an error which means
> future calls to GUP will not succeed, or they should return some non-zero
> number of pinned pages which means GUP should be called again.
>
> If start + nr_pages overflows it should return -EOVERFLOW to signal the
> arguments are invalid.
>
> Syzkaller keeps tripping on this when fuzzing GUP arguments.
>
> Reported-by: syzbot+353c7be4964c6253f24a@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/000000000000094fdd05faa4d3a4@google.com
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> mm/gup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/gup.c b/mm/gup.c
> index bbe4162365933e..36c587fec574fd 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -2969,7 +2969,7 @@ static int internal_get_user_pages_fast(unsigned long start,
> start = untagged_addr(start) & PAGE_MASK;
> len = nr_pages << PAGE_SHIFT;
> if (check_add_overflow(start, len, &end))
> - return 0;
> + return -EOVERFLOW;
I'm curious if there is any sane use case where that could actually
trigger. Smells like something that should be a WARN_ON_ONCE(), but
maybe some callers simply pass through what user-space gave them.
Anyhow.
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-06-21 11:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 18:27 Jason Gunthorpe
2023-06-20 1:38 ` John Hubbard
2023-06-20 21:20 ` Lorenzo Stoakes
2023-06-21 11:24 ` David Hildenbrand [this message]
2023-06-21 11:38 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d86c82d7-2e45-6de8-dcfa-c1dcac06c49a@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jgg@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=linux-mm@kvack.org \
--cc=lstoakes@gmail.com \
--cc=syzbot+353c7be4964c6253f24a@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox