* [PATCH] fix 32-bit compat ioctls for GETXFLAGS, SETXFLAGS, GETVERSION
@ 2007-09-17 1:47 Eric Sandeen
2007-09-17 17:36 ` [PATCH V2] " Eric Sandeen
0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2007-09-17 1:47 UTC (permalink / raw)
To: xfs-oss
XFS_IOC_GETVERSION, XFS_IOC_GETXFLAGS and XFS_IOC_SETXFLAGS all
take a "long" which changes size between 32 and 64 bit platforms.
So, the ioctl cmds that come in from a 32-bit app aren't as expected,
for example on GETXFLAGS,
unknown cmd fd(3) cmd(80046601){t:'f';sz:4}
due to the size mismatch.
So, use instead the 32-bit version of the commands for compat ioctls,
and other than that it doesn't take any more manipulation.
Also, for both native and compat versions, just define them to
the values as defined in fs.h
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Index: linux-2.6.22/fs/xfs/linux-2.6/xfs_ioctl32.c
===================================================================
--- linux-2.6.22.orig/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ linux-2.6.22/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -376,9 +376,6 @@ xfs_compat_ioctl(
switch (cmd) {
case XFS_IOC_DIOINFO:
case XFS_IOC_FSGEOMETRY:
- case XFS_IOC_GETVERSION:
- case XFS_IOC_GETXFLAGS:
- case XFS_IOC_SETXFLAGS:
case XFS_IOC_FSGETXATTR:
case XFS_IOC_FSSETXATTR:
case XFS_IOC_FSGETXATTRA:
@@ -404,6 +401,11 @@ xfs_compat_ioctl(
case XFS_IOC_ERROR_CLEARALL:
break;
+ case XFS_IOC32_GETXFLAGS:
+ case XFS_IOC32_SETXFLAGS:
+ case XFS_IOC32_GETVERSION:
+ cmd = _NATIVE_IOC(cmd, long);
+ break;
#ifdef BROKEN_X86_ALIGNMENT
/* xfs_flock_t has wrong u32 vs u64 alignment */
case XFS_IOC_ALLOCSP_32:
Index: linux-2.6.22/fs/xfs/xfs_fs.h
===================================================================
--- linux-2.6.22.orig/fs/xfs/xfs_fs.h
+++ linux-2.6.22/fs/xfs/xfs_fs.h
@@ -436,9 +436,13 @@ typedef struct xfs_handle {
/*
* ioctl commands that are used by Linux filesystems
*/
-#define XFS_IOC_GETXFLAGS _IOR('f', 1, long)
-#define XFS_IOC_SETXFLAGS _IOW('f', 2, long)
-#define XFS_IOC_GETVERSION _IOR('v', 1, long)
+#define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS
+#define XFS_IOC_SETXFLAGS FS_IOC_SETFLAGS
+#define XFS_IOC_GETVERSION FS_IOC_GETVERSION
+/* 32-bit compat counterparts */
+#define XFS_IOC32_GETXFLAGS FS_IOC32_GETFLAGS
+#define XFS_IOC32_SETXFLAGS FS_IOC32_SETFLAGS
+#define XFS_IOC32_GETVERSION FS_IOC32_GETVERSION
/*
* ioctl commands that replace IRIX fcntl()'s
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH V2] fix 32-bit compat ioctls for GETXFLAGS, SETXFLAGS, GETVERSION
2007-09-17 1:47 [PATCH] fix 32-bit compat ioctls for GETXFLAGS, SETXFLAGS, GETVERSION Eric Sandeen
@ 2007-09-17 17:36 ` Eric Sandeen
2007-09-17 18:08 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2007-09-17 17:36 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
(With rh bug info and attribution for the bug-finder)
---------
In Red Hat bugzilla #291981, Sami Farin notes that 32-bit-compat
lsattr/chattr does not work on xfs. After investigation, I found:
XFS_IOC_GETVERSION, XFS_IOC_GETXFLAGS and XFS_IOC_SETXFLAGS all
take a "long" which changes size between 32 and 64 bit platforms.
So, the ioctl cmds that come in from a 32-bit app aren't as expected,
for example on GETXFLAGS,
unknown cmd fd(3) cmd(80046601){t:'f';sz:4}
due to the size mismatch.
So, use instead the 32-bit version of the commands for compat ioctls,
and other than that it doesn't take any more manipulation.
Also, for both native and compat versions, just define them to
the values as defined in fs.h
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Index: linux-2.6.22/fs/xfs/linux-2.6/xfs_ioctl32.c
===================================================================
--- linux-2.6.22.orig/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ linux-2.6.22/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -376,9 +376,6 @@ xfs_compat_ioctl(
switch (cmd) {
case XFS_IOC_DIOINFO:
case XFS_IOC_FSGEOMETRY:
- case XFS_IOC_GETVERSION:
- case XFS_IOC_GETXFLAGS:
- case XFS_IOC_SETXFLAGS:
case XFS_IOC_FSGETXATTR:
case XFS_IOC_FSSETXATTR:
case XFS_IOC_FSGETXATTRA:
@@ -404,6 +401,11 @@ xfs_compat_ioctl(
case XFS_IOC_ERROR_CLEARALL:
break;
+ case XFS_IOC32_GETXFLAGS:
+ case XFS_IOC32_SETXFLAGS:
+ case XFS_IOC32_GETVERSION:
+ cmd = _NATIVE_IOC(cmd, long);
+ break;
#ifdef BROKEN_X86_ALIGNMENT
/* xfs_flock_t has wrong u32 vs u64 alignment */
case XFS_IOC_ALLOCSP_32:
Index: linux-2.6.22/fs/xfs/xfs_fs.h
===================================================================
--- linux-2.6.22.orig/fs/xfs/xfs_fs.h
+++ linux-2.6.22/fs/xfs/xfs_fs.h
@@ -436,9 +436,13 @@ typedef struct xfs_handle {
/*
* ioctl commands that are used by Linux filesystems
*/
-#define XFS_IOC_GETXFLAGS _IOR('f', 1, long)
-#define XFS_IOC_SETXFLAGS _IOW('f', 2, long)
-#define XFS_IOC_GETVERSION _IOR('v', 1, long)
+#define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS
+#define XFS_IOC_SETXFLAGS FS_IOC_SETFLAGS
+#define XFS_IOC_GETVERSION FS_IOC_GETVERSION
+/* 32-bit compat counterparts */
+#define XFS_IOC32_GETXFLAGS FS_IOC32_GETFLAGS
+#define XFS_IOC32_SETXFLAGS FS_IOC32_SETFLAGS
+#define XFS_IOC32_GETVERSION FS_IOC32_GETVERSION
/*
* ioctl commands that replace IRIX fcntl()'s
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] fix 32-bit compat ioctls for GETXFLAGS, SETXFLAGS, GETVERSION
2007-09-17 17:36 ` [PATCH V2] " Eric Sandeen
@ 2007-09-17 18:08 ` Christoph Hellwig
2007-09-17 18:32 ` Eric Sandeen
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2007-09-17 18:08 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Mon, Sep 17, 2007 at 12:36:02PM -0500, Eric Sandeen wrote:
> Also, for both native and compat versions, just define them to
> the values as defined in fs.h
Should we just kill the XFS_ variants?
Otherwise the patch looks good.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] fix 32-bit compat ioctls for GETXFLAGS, SETXFLAGS, GETVERSION
2007-09-17 18:08 ` Christoph Hellwig
@ 2007-09-17 18:32 ` Eric Sandeen
0 siblings, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2007-09-17 18:32 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs-oss
Christoph Hellwig wrote:
> On Mon, Sep 17, 2007 at 12:36:02PM -0500, Eric Sandeen wrote:
>> Also, for both native and compat versions, just define them to
>> the values as defined in fs.h
>
> Should we just kill the XFS_ variants?
>
> Otherwise the patch looks good.
>
perhaps. It looks like ext3 tried to move GETVERSION, too, though
generic kernel variant still uses the "old" one.
-Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-09-17 18:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-17 1:47 [PATCH] fix 32-bit compat ioctls for GETXFLAGS, SETXFLAGS, GETVERSION Eric Sandeen
2007-09-17 17:36 ` [PATCH V2] " Eric Sandeen
2007-09-17 18:08 ` Christoph Hellwig
2007-09-17 18:32 ` Eric Sandeen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox