Re: [PATCH] fs/compat_ioctl.c: add missing FS_IOC_FIEMAP support

From: Andrew Morton
Date: Mon Aug 03 2009 - 19:23:32 EST


On Mon, 03 Aug 2009 18:07:53 -0400
Mark Lord <lkml@xxxxxx> wrote:

> Eric Sandeen wrote:
> > Mark Lord wrote:
> >> (resending, no ack from anyone first time around).
> >
> > I had previously sent a fix for this to the ext4 list as well, although
> > w/o the added case for compat_ioctl or the extra #include.
> >
> > Because this ioctl should be 100% compat everywhere, I don't -think-
> > it's needed, and
> >
> > http://marc.info/?l=linux-ext4&m=124872536713005&w=2

mutter. I don't read linux-fsdevel much.

> > suffices....
> ..
>
> Well, whichever of the two works best for the maintainers.
>
> We need *something* for it upstream, and probably back in -stable too.
> Otherwise this prevents using 64-bit kernels on 32-bit userland,
> as Linus likes to recommend so often. ;)

OK, here's what I have, with a somewhat reworked changelog.

I assumed that "Josef" == josef@xxxxxxxxxxx

Arnd, could you please check that it still looks OK?

Thanks.


From: Eric Sandeen <sandeen@xxxxxxxxxx>

The FIEMAP_IOC_FIEMAP mapping ioctl was missing a 32-bit compat handler,
which means that 32-bit suerspace on 64-bit kernels cannot use this ioctl
command.

The structure is nicely aligned, padded, and sized, so it is just this
simple.

Tested w/ 32-bit ioctl tester (from Josef) on a 64-bit kernel on ext4.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
Cc: <linux-ext4@xxxxxxxxxxxxxxx>
Cc: Mark Lord <lkml@xxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Josef Bacik <josef@xxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: <stable@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

fs/compat_ioctl.c | 1 +
1 file changed, 1 insertion(+)

diff -puN fs/compat_ioctl.c~compat_ioctl-hook-up-compat-handler-for-fiemap-ioctl fs/compat_ioctl.c
--- a/fs/compat_ioctl.c~compat_ioctl-hook-up-compat-handler-for-fiemap-ioctl
+++ a/fs/compat_ioctl.c
@@ -1838,6 +1838,7 @@ COMPATIBLE_IOCTL(FIONCLEX)
COMPATIBLE_IOCTL(FIOASYNC)
COMPATIBLE_IOCTL(FIONBIO)
COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */
+COMPATIBLE_IOCTL(FS_IOC_FIEMAP)
/* 0x00 */
COMPATIBLE_IOCTL(FIBMAP)
COMPATIBLE_IOCTL(FIGETBSZ)
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/