On Wed, Jan 16, 2019 at 11:41 AM Arnd Bergmann <[email protected]> wrote:
> > +/*
> > + * IO submission data structure (Submission Queue Entry)
> > + */
> > +struct io_uring_sqe {
> > +       __u8    opcode;         /* type of operation for this sqe */
> > +       __u8    flags;          /* as of now unused */
> > +       __u16   ioprio;         /* ioprio for the request */
> > +       __s32   fd;             /* file descriptor to do IO on */
> > +       __u64   off;            /* offset into file */
> > +       union {
> > +               void    *addr;  /* buffer or iovecs */
> > +               __u64   __pad;
> > +       };
>
> It seems a bit unfortunate to keep the pointer field only
> almost compatible between 32-bit and 64-bit big-endian
> architectures, as that requires an in_compat_syscall()
> check whenever we access the pointer from the kernel.
>
> Could you use a __u64 field to store the pointer itself
> instead?

To clarify: Using the u64_to_user_ptr() helper function,
you can interpret a __u64 field in a uapi data structure
directly as a pointer. The user space side needs a similar
wrapper though.

     Arnd

Reply via email to