linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] userfaultfd: fix UFFDIO_CONTINUE ioctl request definition
@ 2021-06-01 14:34 Gleb Fotengauer-Malinovskiy
  2021-06-01 16:41 ` Axel Rasmussen
  2021-06-23  2:42 ` Dmitry V. Levin
  0 siblings, 2 replies; 3+ messages in thread
From: Gleb Fotengauer-Malinovskiy @ 2021-06-01 14:34 UTC (permalink / raw)
  To: Andrew Morton, Axel Rasmussen, Peter Xu, Mike Kravetz,
	Andrea Arcangeli, Lokesh Gidra, linux-kernel
  Cc: Gleb Fotengauer-Malinovskiy

This ioctl request reads from uffdio_continue structure which justifies
_IOC_READ flag.
See NOTEs in include/uapi/asm-generic/ioctl.h for more information.

Fixes: f619147104c8 ("userfaultfd: add UFFDIO_CONTINUE ioctl")
Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Acked-by: Peter Xu <peterx@redhat.com>
---
 include/uapi/linux/userfaultfd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

v2 fix commit message

diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h
index bafbeb1a2624..650480f41f1d 100644
--- a/include/uapi/linux/userfaultfd.h
+++ b/include/uapi/linux/userfaultfd.h
@@ -80,8 +80,8 @@
 				      struct uffdio_zeropage)
 #define UFFDIO_WRITEPROTECT	_IOWR(UFFDIO, _UFFDIO_WRITEPROTECT, \
 				      struct uffdio_writeprotect)
-#define UFFDIO_CONTINUE		_IOR(UFFDIO, _UFFDIO_CONTINUE,	\
-				     struct uffdio_continue)
+#define UFFDIO_CONTINUE		_IOWR(UFFDIO, _UFFDIO_CONTINUE,	\
+				      struct uffdio_continue)
 
 /* read() structure */
 struct uffd_msg {
-- 
glebfm


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] userfaultfd: fix UFFDIO_CONTINUE ioctl request definition
  2021-06-01 14:34 [PATCH v2] userfaultfd: fix UFFDIO_CONTINUE ioctl request definition Gleb Fotengauer-Malinovskiy
@ 2021-06-01 16:41 ` Axel Rasmussen
  2021-06-23  2:42 ` Dmitry V. Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Axel Rasmussen @ 2021-06-01 16:41 UTC (permalink / raw)
  To: Gleb Fotengauer-Malinovskiy
  Cc: Andrew Morton, Peter Xu, Mike Kravetz, Andrea Arcangeli,
	Lokesh Gidra, LKML

Thanks for catching this!

Reviewed-by: Axel Rasmussen <axelrasmussen@google.com>

On Tue, Jun 1, 2021 at 7:34 AM Gleb Fotengauer-Malinovskiy
<glebfm@altlinux.org> wrote:
>
> This ioctl request reads from uffdio_continue structure which justifies
> _IOC_READ flag.
> See NOTEs in include/uapi/asm-generic/ioctl.h for more information.
>
> Fixes: f619147104c8 ("userfaultfd: add UFFDIO_CONTINUE ioctl")
> Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
> Acked-by: Peter Xu <peterx@redhat.com>
> ---
>  include/uapi/linux/userfaultfd.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> v2 fix commit message
>
> diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h
> index bafbeb1a2624..650480f41f1d 100644
> --- a/include/uapi/linux/userfaultfd.h
> +++ b/include/uapi/linux/userfaultfd.h
> @@ -80,8 +80,8 @@
>                                       struct uffdio_zeropage)
>  #define UFFDIO_WRITEPROTECT    _IOWR(UFFDIO, _UFFDIO_WRITEPROTECT, \
>                                       struct uffdio_writeprotect)
> -#define UFFDIO_CONTINUE                _IOR(UFFDIO, _UFFDIO_CONTINUE,  \
> -                                    struct uffdio_continue)
> +#define UFFDIO_CONTINUE                _IOWR(UFFDIO, _UFFDIO_CONTINUE, \
> +                                     struct uffdio_continue)
>
>  /* read() structure */
>  struct uffd_msg {
> --
> glebfm
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] userfaultfd: fix UFFDIO_CONTINUE ioctl request definition
  2021-06-01 14:34 [PATCH v2] userfaultfd: fix UFFDIO_CONTINUE ioctl request definition Gleb Fotengauer-Malinovskiy
  2021-06-01 16:41 ` Axel Rasmussen
@ 2021-06-23  2:42 ` Dmitry V. Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry V. Levin @ 2021-06-23  2:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Gleb Fotengauer-Malinovskiy, Axel Rasmussen, Peter Xu,
	Mike Kravetz, Andrea Arcangeli, Lokesh Gidra, linux-kernel

Hi,

On Tue, Jun 01, 2021 at 05:34:32PM +0300, Gleb Fotengauer-Malinovskiy wrote:
> This ioctl request reads from uffdio_continue structure which justifies
> _IOC_READ flag.
> See NOTEs in include/uapi/asm-generic/ioctl.h for more information.

These ioctl flag usage rules seem to be a perpetual source of mistakes.
I suggest a slightly different wording of the commit message which is
hopefully a bit easier to follow:

"This ioctl request reads from uffdio_continue structure written by
userspace which justifies _IOC_WRITE flag.  It also writes back to that
structure which justifies _IOC_READ flag.

See NOTEs in include/uapi/asm-generic/ioctl.h for more information."
 
Please make sure this patch is merged before v5.13 is released, otherwise
the UAPI bug would have to stay for backwards ABI compatibility.

> Fixes: f619147104c8 ("userfaultfd: add UFFDIO_CONTINUE ioctl")
> Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
> Acked-by: Peter Xu <peterx@redhat.com>
> ---
>  include/uapi/linux/userfaultfd.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> v2 fix commit message
> 
> diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h
> index bafbeb1a2624..650480f41f1d 100644
> --- a/include/uapi/linux/userfaultfd.h
> +++ b/include/uapi/linux/userfaultfd.h
> @@ -80,8 +80,8 @@
>  				      struct uffdio_zeropage)
>  #define UFFDIO_WRITEPROTECT	_IOWR(UFFDIO, _UFFDIO_WRITEPROTECT, \
>  				      struct uffdio_writeprotect)
> -#define UFFDIO_CONTINUE		_IOR(UFFDIO, _UFFDIO_CONTINUE,	\
> -				     struct uffdio_continue)
> +#define UFFDIO_CONTINUE		_IOWR(UFFDIO, _UFFDIO_CONTINUE,	\
> +				      struct uffdio_continue)
>  
>  /* read() structure */
>  struct uffd_msg {

Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>


-- 
ldv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-23  2:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 14:34 [PATCH v2] userfaultfd: fix UFFDIO_CONTINUE ioctl request definition Gleb Fotengauer-Malinovskiy
2021-06-01 16:41 ` Axel Rasmussen
2021-06-23  2:42 ` Dmitry V. Levin

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).