aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2019-04-24 10:14:11 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2019-04-24 11:05:07 -0400
commit6407f44aaf2a39b5ccbb1cc1d342b906dcfa8a87 (patch)
tree62dec382d81a519220a349dbf42697cdec26966a /fs/fuse
parent29cc02d949b19fdeba9de9f54b2641005f5865c6 (diff)
fuse: Add ioctl flag for x32 compat ioctl
Currently, a CUSE server running on a 64-bit kernel can tell when an ioctl request comes from a process running a 32-bit ABI, but cannot tell whether the requesting process is using legacy IA32 emulation or x32 ABI. In particular, the server does not know the size of the client process's `time_t` type. For 64-bit kernels, the `FUSE_IOCTL_COMPAT` and `FUSE_IOCTL_32BIT` flags are currently set in the ioctl input request (`struct fuse_ioctl_in` member `flags`) for a 32-bit requesting process. This patch defines a new flag `FUSE_IOCTL_COMPAT_X32` and sets it if the 32-bit requesting process is using the x32 ABI. This allows the server process to distinguish between requests coming from client processes using IA32 emulation or the x32 ABI and so infer the size of the client process's `time_t` type and any other IA32/x32 differences. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 1f9da7a5ad0d..3959f08279e6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2578,8 +2578,13 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
2578#if BITS_PER_LONG == 32 2578#if BITS_PER_LONG == 32
2579 inarg.flags |= FUSE_IOCTL_32BIT; 2579 inarg.flags |= FUSE_IOCTL_32BIT;
2580#else 2580#else
2581 if (flags & FUSE_IOCTL_COMPAT) 2581 if (flags & FUSE_IOCTL_COMPAT) {
2582 inarg.flags |= FUSE_IOCTL_32BIT; 2582 inarg.flags |= FUSE_IOCTL_32BIT;
2583#ifdef CONFIG_X86_X32
2584 if (in_x32_syscall())
2585 inarg.flags |= FUSE_IOCTL_COMPAT_X32;
2586#endif
2587 }
2583#endif 2588#endif
2584 2589
2585 /* assume all the iovs returned by client always fits in a page */ 2590 /* assume all the iovs returned by client always fits in a page */