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>
This commit is contained in:
committed by
Linus Torvalds
parent
baed7fc9b5
commit
e28cbf2293
@ -5,7 +5,8 @@
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
|
||||
#define COMPAT_USER_HZ 100
|
||||
#define COMPAT_USER_HZ 100
|
||||
#define COMPAT_UTS_MACHINE "sparc\0\0"
|
||||
|
||||
typedef u32 compat_size_t;
|
||||
typedef s32 compat_ssize_t;
|
||||
|
@ -510,17 +510,6 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE1(sparc64_newuname, struct new_utsname __user *, name)
|
||||
{
|
||||
int ret = sys_newuname(name);
|
||||
|
||||
if (current->personality == PER_LINUX32 && !ret) {
|
||||
ret = (copy_to_user(name->machine, "sparc\0\0", 8)
|
||||
? -EFAULT : 0);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE1(sparc64_personality, unsigned long, personality)
|
||||
{
|
||||
int ret;
|
||||
|
@ -6,15 +6,12 @@
|
||||
#include <asm/utrap.h>
|
||||
#include <asm/signal.h>
|
||||
|
||||
struct new_utsname;
|
||||
|
||||
extern asmlinkage unsigned long sys_getpagesize(void);
|
||||
extern asmlinkage long sparc_pipe(struct pt_regs *regs);
|
||||
extern asmlinkage long sys_sparc_ipc(unsigned int call, int first,
|
||||
unsigned long second,
|
||||
unsigned long third,
|
||||
void __user *ptr, long fifth);
|
||||
extern asmlinkage long sparc64_newuname(struct new_utsname __user *name);
|
||||
extern asmlinkage long sparc64_personality(unsigned long personality);
|
||||
extern asmlinkage long sys64_munmap(unsigned long addr, size_t len);
|
||||
extern asmlinkage unsigned long sys64_mremap(unsigned long addr,
|
||||
|
@ -55,7 +55,7 @@ sys_call_table32:
|
||||
/*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents
|
||||
.word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr
|
||||
/*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
|
||||
.word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sys_sparc64_newuname
|
||||
.word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sys_newuname
|
||||
/*190*/ .word sys32_init_module, sys_sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl
|
||||
.word sys32_epoll_wait, sys32_ioprio_set, sys_getppid, sys32_sigaction, sys_sgetmask
|
||||
/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
|
||||
@ -130,7 +130,7 @@ sys_call_table:
|
||||
/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
|
||||
.word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
|
||||
/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_nis_syscall, sys_ni_syscall
|
||||
.word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_sparc64_newuname
|
||||
.word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname
|
||||
/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
|
||||
.word sys_epoll_wait, sys_ioprio_set, sys_getppid, sys_nis_syscall, sys_sgetmask
|
||||
/*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall
|
||||
|
Reference in New Issue
Block a user