]> bbs.cooldavid.org Git - net-next-2.6.git/commit
fix rawctl compat ioctls breakage on amd64 and itanic
authorAl Viro <viro@ZenIV.linux.org.uk>
Mon, 24 Aug 2009 22:42:56 +0000 (22:42 +0000)
committerArnd Bergmann <arnd@arndb.de>
Tue, 19 Oct 2010 09:29:54 +0000 (11:29 +0200)
commitc4a047272566b44b44222369d50a307c708c4f74
tree05f3883b35741afb8afec90c61891f8a1b2c8da9
parent9a181c58617134822ae596339dbea076ef9b5cf7
fix rawctl compat ioctls breakage on amd64 and itanic

RAW_SETBIND and RAW_GETBIND 32bit versions are fscked in interesting ways.

1) fs/compat_ioctl.c has COMPATIBLE_IOCTL(RAW_SETBIND) followed by
HANDLE_IOCTL(RAW_SETBIND, raw_ioctl).  The latter is ignored.

2) on amd64 (and itanic) the damn thing is broken - we have int + u64 + u64
and layouts on i386 and amd64 are _not_ the same.  raw_ioctl() would
work there, but it's never called due to (1).  As it is, i386 /sbin/raw
definitely doesn't work on amd64 boxen.

3) switching to raw_ioctl() as is would *not* work on e.g. sparc64 and ppc64,
which would be rather sad, seeing that normal userland there is 32bit.
The thing is, slapping __packed on the struct in question does not DTRT -
it eliminates *all* padding.  The real solution is to use compat_u64.

4) of course, all that stuff has no business being outside of raw.c in the
first place - there should be ->compat_ioctl() for /dev/rawctl instead of
messing with compat_ioctl.c.

[akpm@linux-foundation.org: coding-style fixes]
[arnd@arndb.de: port to 2.6.36]
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
drivers/char/raw.c
fs/compat_ioctl.c