improve sys_newuname() for compat architectures

On an architecture that supports 32-bit compat we need to override the
reported machine in uname with the 32-bit value.  Instead of doing this
separately in every architecture introduce a COMPAT_UTS_MACHINE define in
<asm/compat.h> and apply it directly in sys_newuname().

Signed-off-by: Christoph Hellwig <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mundt <[email protected]>
Cc: Jeff Dike <[email protected]>
Cc: Hirokazu Takata <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: "Luck, Tony" <[email protected]>
Cc: James Morris <[email protected]>
Cc: Andreas Schwab <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Christoph Hellwig 2010-03-10 15:21:19 -08:00 • committed by Linus Torvalds
commit e28cbf2293
28 changed files with 36 additions and 123 deletions

View file

@ -7,7 +7,8 @@
#include <linux/sched.h>
#include <linux/thread_info.h>
#define COMPAT_USER_HZ 100
#define COMPAT_USER_HZ 100
#define COMPAT_UTS_MACHINE "parisc\0\0"
typedef u32 compat_size_t;
typedef s32 compat_ssize_t;

View file

@ -234,18 +234,3 @@ long parisc_personality(unsigned long personality)
return err;
}
long parisc_newuname(struct new_utsname __user *name)
{
int err = sys_newuname(name);
#ifdef CONFIG_COMPAT
if (!err && personality(current->personality) == PER_LINUX32) {
if (__put_user(0, name->machine + 6) ||
__put_user(0, name->machine + 7))
err = -EFAULT;
}
#endif
return err;
}

View file

@ -127,7 +127,7 @@
ENTRY_SAME(socketpair)
ENTRY_SAME(setpgid)
ENTRY_SAME(send)
ENTRY_OURS(newuname)
ENTRY_SAME(newuname)
ENTRY_SAME(umask) /* 60 */
ENTRY_SAME(chroot)
ENTRY_COMP(ustat)