Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl

2015-10-29 Thread Thomas Rohwer
Hello, I've investigated this now, and it seems to be the pointer-type clone_sources member of struct btrfs_ioctl_send_args. I can't think of a perfect way to fix this, but it might not be *too* ugly to: - replace the current clone_sources with a u64 that must always be (u64)-1; this causes

Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl

2015-10-29 Thread David Sterba
On Thu, Oct 29, 2015 at 01:05:13PM +0100, Thomas Rohwer wrote: > Investigating the source, I noticed that probably the problem is the member > clone_sources in the structure That's, right. Yet another thing to keep in mind when designing ioctls. > struct btrfs_ioctl_send_args { >__s64

Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl

2015-10-29 Thread David Sterba
On Thu, Oct 29, 2015 at 08:22:34AM +, Luke Dashjr wrote: > > > I don't see what is different with that implementation. All > > > f2fs_compat_ioctl does is change cmd to the plain-IOC equivalent and > > > call f2fs_ioctl with the same arg (compat_ptr merely causes a cast to > > > void* and

Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl

2015-10-29 Thread Thomas Rohwer
I suggest to add an anonymous union and add a u64 member that would force the type width: struct btrfs_ioctl_send_args { __s64 send_fd; /* in */ __u64 clone_sources_count; /* in */ union { __u64 __user *clone_sources;/* in */

Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl

2015-10-29 Thread Luke Dashjr
On Thursday, October 29, 2015 7:36:35 PM Thomas Rohwer wrote: > > I suggest to add an anonymous union and add a u64 member that would > > force the type width: > > > > struct btrfs_ioctl_send_args { > > > > __s64 send_fd; /* in */ > > __u64 clone_sources_count;

Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl

2015-10-29 Thread Luke Dashjr
On Thursday, October 29, 2015 2:39:32 PM David Sterba wrote: > On Thu, Oct 29, 2015 at 08:22:34AM +, Luke Dashjr wrote: > > > In what way is SEND broken? There are only u64/s64 members in > > > btrfs_ioctl_send_args, I don't see how this could break on 32/64 > > > userspace/kernel. > > > >

Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl

2015-10-29 Thread Luke Dashjr
On Friday, May 15, 2015 11:19:22 AM David Sterba wrote: > On Thu, May 14, 2015 at 04:27:54PM +, Luke Dashjr wrote: > > On Thursday, May 14, 2015 2:06:17 PM David Sterba wrote: > > > On Wed, May 13, 2015 at 05:15:26PM +, Luke Dashjr wrote: > > > > 32-bit ioctl uses these rather than the