linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: fix NVME_IOCTL_SUBMIT_IO for compat_ioctl
@ 2020-02-28  9:28 masahiro31.yamada
  2020-02-29 18:59 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: masahiro31.yamada @ 2020-02-28  9:28 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi, linux-nvme, linux-kernel

From: Masahiro Yamada <masahiro31.yamada@kioxia.com>

Currently 32 bit application gets ENOTTY when it calls
compat_ioctl with NVME_IOCTL_SUBMIT_IO in 64 bit kernel.

The cause is that the results of sizeof(struct nvme_user_io),
which is used to define NVME_IOCTL_SUBMIT_IO,
are not same between 32 bit compiler and 64 bit compiler.

* 32 bit: the result of sizeof nvme_user_io is 44.
* 64 bit: the result of sizeof nvme_user_io is 48.

64 bit compiler seems to add 32 bit padding for multiple of 8 bytes.

This patch adds 32 bit padding to struct nvme_user_io
for 32 bit compiler to define same NVME_IOCTL_SUBMIT_IO as 64 bit.

nvme-cli also needs to be fixed if this patch is accepted.

Signed-off-by: Masahiro Yamada <masahiro31.yamada@kioxia.com>
---
 include/uapi/linux/nvme_ioctl.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/nvme_ioctl.h b/include/uapi/linux/nvme_ioctl.h
index d99b5a772698..a50ea474c21a 100644
--- a/include/uapi/linux/nvme_ioctl.h
+++ b/include/uapi/linux/nvme_ioctl.h
@@ -14,7 +14,7 @@ struct nvme_user_io {
 	__u8	flags;
 	__u16	control;
 	__u16	nblocks;
-	__u16	rsvd;
+	__u16	rsvd1;
 	__u64	metadata;
 	__u64	addr;
 	__u64	slba;
@@ -22,6 +22,7 @@ struct nvme_user_io {
 	__u32	reftag;
 	__u16	apptag;
 	__u16	appmask;
+	__u32	rsvd2;
 };
 
 struct nvme_passthru_cmd {
-- 
2.20.1




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

* Re: [PATCH] nvme: fix NVME_IOCTL_SUBMIT_IO for compat_ioctl
  2020-02-28  9:28 [PATCH] nvme: fix NVME_IOCTL_SUBMIT_IO for compat_ioctl masahiro31.yamada
@ 2020-02-29 18:59 ` Christoph Hellwig
  2020-03-02  4:31   ` masahiro31.yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2020-02-29 18:59 UTC (permalink / raw)
  To: masahiro31.yamada; +Cc: kbusch, axboe, hch, sagi, linux-nvme, linux-kernel

We can't just change the existing structure, instead we'll need
a compat handler for the 32-bit x86 case.

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

* RE: [PATCH] nvme: fix NVME_IOCTL_SUBMIT_IO for compat_ioctl
  2020-02-29 18:59 ` Christoph Hellwig
@ 2020-03-02  4:31   ` masahiro31.yamada
  0 siblings, 0 replies; 3+ messages in thread
From: masahiro31.yamada @ 2020-03-02  4:31 UTC (permalink / raw)
  To: hch; +Cc: kbusch, axboe, hch, sagi, linux-nvme, linux-kernel

>We can't just change the existing structure, instead we'll need
>a compat handler for the 32-bit x86 case.

Thank you for your comment.
OK. I'll recreate this patch which adds a handler for compat_ioctl,
not to change the existing structure.

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

end of thread, other threads:[~2020-03-02  4:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28  9:28 [PATCH] nvme: fix NVME_IOCTL_SUBMIT_IO for compat_ioctl masahiro31.yamada
2020-02-29 18:59 ` Christoph Hellwig
2020-03-02  4:31   ` masahiro31.yamada

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