linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2 2/6] userfaultfd: add /dev/userfaultfd for fine grained access control
       [not found] ` <20220422212945.2227722-3-axelrasmussen@google.com>
@ 2022-04-25 20:32   ` Dmitry V. Levin
  2022-04-26 16:00     ` Axel Rasmussen
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry V. Levin @ 2022-04-25 20:32 UTC (permalink / raw)
  To: Axel Rasmussen
  Cc: Alexander Viro, Andrew Morton, Charan Teja Reddy, Dave Hansen,
	Gleb Fotengauer-Malinovskiy, Hugh Dickins, Jan Kara,
	Jonathan Corbet, Mel Gorman, Mike Kravetz, Mike Rapoport,
	Nadav Amit, Peter Xu, Shuah Khan, Suren Baghdasaryan,
	Vlastimil Babka, zhangyi, linux-api, linux-doc, linux-fsdevel,
	linux-kernel, linux-mm, linux-kselftest

On Fri, Apr 22, 2022 at 02:29:41PM -0700, Axel Rasmussen wrote:
[...]
> --- a/include/uapi/linux/userfaultfd.h
> +++ b/include/uapi/linux/userfaultfd.h
> @@ -12,6 +12,10 @@
>  
>  #include <linux/types.h>
>  
> +/* ioctls for /dev/userfaultfd */
> +#define USERFAULTFD_IOC 0xAA
> +#define USERFAULTFD_IOC_NEW _IOWR(USERFAULTFD_IOC, 0x00, int)

Why this new ioctl is defined using _IOWR()?  Since it neither reads from
user memory nor writes into user memory, it should rather be defined using
_IO(), shouldn't it?


-- 
ldv

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

* Re: [PATCH v2 2/6] userfaultfd: add /dev/userfaultfd for fine grained access control
  2022-04-25 20:32   ` [PATCH v2 2/6] userfaultfd: add /dev/userfaultfd for fine grained access control Dmitry V. Levin
@ 2022-04-26 16:00     ` Axel Rasmussen
  2022-04-26 17:13       ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Axel Rasmussen @ 2022-04-26 16:00 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Alexander Viro, Andrew Morton, Charan Teja Reddy, Dave Hansen,
	Gleb Fotengauer-Malinovskiy, Hugh Dickins, Jan Kara,
	Jonathan Corbet, Mel Gorman, Mike Kravetz, Mike Rapoport,
	Nadav Amit, Peter Xu, Shuah Khan, Suren Baghdasaryan,
	Vlastimil Babka, zhangyi, linux-api, linux-doc, linux-fsdevel,
	LKML, Linux MM, Linuxkselftest

You're right, [1] says _IO is appropriate for ioctls which only take
an integer argument. I'll send a v3 with this fix, although I might
wait a bit for any other review comments before doing so. Thanks for
taking a look!

https://www.kernel.org/doc/html/latest/driver-api/ioctl.html

On Mon, Apr 25, 2022 at 1:32 PM Dmitry V. Levin <ldv@altlinux.org> wrote:
>
> On Fri, Apr 22, 2022 at 02:29:41PM -0700, Axel Rasmussen wrote:
> [...]
> > --- a/include/uapi/linux/userfaultfd.h
> > +++ b/include/uapi/linux/userfaultfd.h
> > @@ -12,6 +12,10 @@
> >
> >  #include <linux/types.h>
> >
> > +/* ioctls for /dev/userfaultfd */
> > +#define USERFAULTFD_IOC 0xAA
> > +#define USERFAULTFD_IOC_NEW _IOWR(USERFAULTFD_IOC, 0x00, int)
>
> Why this new ioctl is defined using _IOWR()?  Since it neither reads from
> user memory nor writes into user memory, it should rather be defined using
> _IO(), shouldn't it?
>
>
> --
> ldv

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

* Re: [PATCH v2 2/6] userfaultfd: add /dev/userfaultfd for fine grained access control
  2022-04-26 16:00     ` Axel Rasmussen
@ 2022-04-26 17:13       ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2022-04-26 17:13 UTC (permalink / raw)
  To: Axel Rasmussen
  Cc: Dmitry V. Levin, Alexander Viro, Andrew Morton, Charan Teja Reddy,
	Dave Hansen, Gleb Fotengauer-Malinovskiy, Hugh Dickins, Jan Kara,
	Jonathan Corbet, Mel Gorman, Mike Kravetz, Mike Rapoport,
	Nadav Amit, Peter Xu, Shuah Khan, Suren Baghdasaryan,
	Vlastimil Babka, zhangyi, Linux API, open list:DOCUMENTATION,
	Linux FS-devel Mailing List, LKML, Linux MM, Linuxkselftest

On Tue, Apr 26, 2022 at 6:00 PM Axel Rasmussen <axelrasmussen@google.com> wrote:
>
> You're right, [1] says _IO is appropriate for ioctls which only take
> an integer argument. I'll send a v3 with this fix, although I might
> wait a bit for any other review comments before doing so. Thanks for
> taking a look!

If there are no other command codes, you could also set .compat_ioctl
to the same function pointer as .unlocked_ioctl, the compat_ptr_ioctl
conversion is only needed when there are commands that take a pointer.

        Armd

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

end of thread, other threads:[~2022-04-26 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220422212945.2227722-1-axelrasmussen@google.com>
     [not found] ` <20220422212945.2227722-3-axelrasmussen@google.com>
2022-04-25 20:32   ` [PATCH v2 2/6] userfaultfd: add /dev/userfaultfd for fine grained access control Dmitry V. Levin
2022-04-26 16:00     ` Axel Rasmussen
2022-04-26 17:13       ` Arnd Bergmann

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