diff options
author | Christoph Hellwig <hch@lst.de> | 2010-03-10 18:21:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:32 -0500 |
commit | e28cbf22933d0c0ccaf3c4c27a1a263b41f73859 (patch) | |
tree | a93ff48cfd97766a23b2c4f3ea86fccfc9c51d3f /arch/x86 | |
parent | baed7fc9b580bd3fb8252ff1d9b36eaf1f86b670 (diff) |
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 <hch@lst.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: James Morris <jmorris@namei.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/compat.h | 3 | ||||
-rw-r--r-- | arch/x86/include/asm/syscalls.h | 3 | ||||
-rw-r--r-- | arch/x86/include/asm/unistd_64.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/sys_x86_64.c | 12 |
4 files changed, 3 insertions, 17 deletions
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h index 9a9c7bdc923d..306160e58b48 100644 --- a/arch/x86/include/asm/compat.h +++ b/arch/x86/include/asm/compat.h | |||
@@ -8,7 +8,8 @@ | |||
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <asm/user32.h> | 9 | #include <asm/user32.h> |
10 | 10 | ||
11 | #define COMPAT_USER_HZ 100 | 11 | #define COMPAT_USER_HZ 100 |
12 | #define COMPAT_UTS_MACHINE "i686\0\0" | ||
12 | 13 | ||
13 | typedef u32 compat_size_t; | 14 | typedef u32 compat_size_t; |
14 | typedef s32 compat_ssize_t; | 15 | typedef s32 compat_ssize_t; |
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h index 50f6a569f0d1..47cd606c3537 100644 --- a/arch/x86/include/asm/syscalls.h +++ b/arch/x86/include/asm/syscalls.h | |||
@@ -68,11 +68,8 @@ int sys_vm86(unsigned long, unsigned long, struct pt_regs *); | |||
68 | long sys_arch_prctl(int, unsigned long); | 68 | long sys_arch_prctl(int, unsigned long); |
69 | 69 | ||
70 | /* kernel/sys_x86_64.c */ | 70 | /* kernel/sys_x86_64.c */ |
71 | struct new_utsname; | ||
72 | |||
73 | asmlinkage long sys_mmap(unsigned long, unsigned long, unsigned long, | 71 | asmlinkage long sys_mmap(unsigned long, unsigned long, unsigned long, |
74 | unsigned long, unsigned long, unsigned long); | 72 | unsigned long, unsigned long, unsigned long); |
75 | asmlinkage long sys_uname(struct new_utsname __user *); | ||
76 | 73 | ||
77 | #endif /* CONFIG_X86_32 */ | 74 | #endif /* CONFIG_X86_32 */ |
78 | #endif /* _ASM_X86_SYSCALLS_H */ | 75 | #endif /* _ASM_X86_SYSCALLS_H */ |
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h index 4843f7ba754a..83e2d6dc5038 100644 --- a/arch/x86/include/asm/unistd_64.h +++ b/arch/x86/include/asm/unistd_64.h | |||
@@ -146,7 +146,7 @@ __SYSCALL(__NR_wait4, sys_wait4) | |||
146 | #define __NR_kill 62 | 146 | #define __NR_kill 62 |
147 | __SYSCALL(__NR_kill, sys_kill) | 147 | __SYSCALL(__NR_kill, sys_kill) |
148 | #define __NR_uname 63 | 148 | #define __NR_uname 63 |
149 | __SYSCALL(__NR_uname, sys_uname) | 149 | __SYSCALL(__NR_uname, sys_newuname) |
150 | 150 | ||
151 | #define __NR_semget 64 | 151 | #define __NR_semget 64 |
152 | __SYSCALL(__NR_semget, sys_semget) | 152 | __SYSCALL(__NR_semget, sys_semget) |
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index 8aa2057efd12..ff14a5044ce6 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c | |||
@@ -209,15 +209,3 @@ bottomup: | |||
209 | 209 | ||
210 | return addr; | 210 | return addr; |
211 | } | 211 | } |
212 | |||
213 | |||
214 | SYSCALL_DEFINE1(uname, struct new_utsname __user *, name) | ||
215 | { | ||
216 | int err; | ||
217 | down_read(&uts_sem); | ||
218 | err = copy_to_user(name, utsname(), sizeof(*name)); | ||
219 | up_read(&uts_sem); | ||
220 | if (personality(current->personality) == PER_LINUX32) | ||
221 | err |= copy_to_user(&name->machine, "i686", 5); | ||
222 | return err ? -EFAULT : 0; | ||
223 | } | ||