LKML Archive on
help / color / mirror / Atom feed
From: Alan Cox <>
To: "Michael S. Tsirkin" <>
Cc: Linus Torvalds <>,
	Al Viro <>,
	Linux Kernel Mailing List <>,
	stable <>,,
	linux-mm <>,
	"Kirill A. Shutemov" <>,
	Andrew Morton <>,
	Huang Ying <>,
	Jonathan Corbet <>,
	Peter Zijlstra <>,
	Thomas Gleixner <>,
	Thorsten Leemhuis <>
Subject: Re: [PATCH] gup: return -EFAULT on access_ok failure
Date: Fri, 6 Apr 2018 12:35:45 +0100	[thread overview]
Message-ID: <20180406123545.24953eb4@alans-desktop> (raw)
In-Reply-To: <>

> so an error on the 1st page gets propagated to the caller,
> and that get_user_pages_unlocked eventually calls __get_user_pages
> so it does return an error sometimes.
> Would it be correct to apply the second part of the patch then
> (pasted below for reference) or should get_user_pages_fast
> and all its callers be changed to return 0 on error instead?

0 isn't an error. As SuS sees it (ie from the userspace end of the pile)

returning the number you asked for means it worked

returning a smaller number means it worked partially and that much was
consumed (or in some cases more and the rest if so was lost - depends
what you are reading/writing)

returning 0 means you read nothing as you were at the end of file

returning an error code means it broke, or you should try again

The ugly bit there is the try-again semantics needs to exactly match the
attached poll() behaviour or you get busy loops.


      parent reply	other threads:[~2018-04-06 11:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2018-04-05  1:53 ` Michael S. Tsirkin
2018-04-05  2:40   ` Linus Torvalds
2018-04-05 14:17     ` Michael S. Tsirkin
2018-04-05 15:40       ` Linus Torvalds
2018-04-05 18:28         ` Michael S. Tsirkin
2018-04-05 18:43           ` Linus Torvalds
2018-04-05 19:34             ` Michael S. Tsirkin
2018-04-05 19:39               ` Chris Wilson
2018-04-05 21:08             ` Michael S. Tsirkin
2018-04-06 11:35           ` Alan Cox [this message]

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180406123545.24953eb4@alans-desktop \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] gup: return -EFAULT on access_ok failure' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).