Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1258955
| From | Luke Dashjr <luke@dashjr.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl |
| Date | 2015-10-29 20:10 +0100 |
| Message-ID | <qp0Kd-4f9-15@gated-at.bofh.it> (permalink) |
| References | <ppIDM-6NW-3@gated-at.bofh.it> <qoQUy-6fX-25@gated-at.bofh.it> <qoWGB-1rT-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thursday, October 29, 2015 2:39:32 PM David Sterba wrote:
> On Thu, Oct 29, 2015 at 08:22:34AM +0000, 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.
> >
> > 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 older kernels to error cleanly if called with a new ioctl
> > data
> >
> > - use the top 1 or 2 bits of flags to indicate sizeof(void*) as it
> > appears to
> >
> > userspace OR just use up reserved[0] for pointer size:
> > io_send.ptr_size = sizeof(void*);
> >
> > - replace one of the reserved fields with the new clone_sources
>
> All the change seem too intrusive or not so easy to use.
>
> 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 */
> u64 __pointer_alignment;
> };
> __u64 parent_root; /* in */
> __u64 flags; /* in */
> __u64 reserved[4]; /* in */
> };
What guarantees the union to position clone_sources in the LSB of
__pointer_alignment (rather than the MSB side)?
> > The way it was done for receive seems like it might not work for non-x86
> > compat interfaces (eg, MIPS n32) - but I could be wrong.
>
> Possible, but I don't see right now how it would not work on eg. mips32.
> unless sizeof(long) is 8 bytes there and CONFIG_64BIT is not defined.
n32 is a MIPS64 ABI, like the new x32 ABI for x86_64 machines, so I would
expect sizeof(long) to be 8 bytes, and am uncertain of if this implies any
particular alignment. (But I don't have any MIPS systems, so this isn't
something I'm too concerned with myself.)
Luke
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl Luke Dashjr <luke@dashjr.org> - 2015-10-29 09:40 +0100
Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl Thomas Rohwer <tr@ohwer.de> - 2015-10-29 13:20 +0100
Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl David Sterba <dsterba@suse.cz> - 2015-10-29 16:30 +0100
Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl David Sterba <dsterba@suse.cz> - 2015-10-29 15:50 +0100
Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl Luke Dashjr <luke@dashjr.org> - 2015-10-29 20:10 +0100
Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl Thomas Rohwer <tr@ohwer.de> - 2015-10-29 20:40 +0100
Re: [PATCH] btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl Luke Dashjr <luke@dashjr.org> - 2015-10-29 21:10 +0100
csiph-web