From 8e7a4f69e4ed328aa09ce48601073052557fa85d Mon Sep 17 00:00:00 2001 From: "blaisorblade@yahoo.it" Date: Sun, 1 May 2005 08:58:53 -0700 Subject: [PATCH] uml: add nfsd syscall when nfsd is modular This trick is useless, because sys_ni.c will handle this problem by itself, like it does even on UML for other syscalls. Also, it does not provide the NFSD syscall when NFSD is compiled as a module, which is a big problem. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/kernel/sys_call_table.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'arch/um') diff --git a/arch/um/kernel/sys_call_table.c b/arch/um/kernel/sys_call_table.c index 7fc06c85b29d..b671a31a0069 100644 --- a/arch/um/kernel/sys_call_table.c +++ b/arch/um/kernel/sys_call_table.c @@ -14,12 +14,6 @@ #include "sysdep/syscalls.h" #include "kern_util.h" -#ifdef CONFIG_NFSD -#define NFSSERVCTL sys_nfsservctl -#else -#define NFSSERVCTL sys_ni_syscall -#endif - #define LAST_GENERIC_SYSCALL __NR_keyctl #if LAST_GENERIC_SYSCALL > LAST_ARCH_SYSCALL @@ -189,7 +183,7 @@ syscall_handler_t *sys_call_table[] = { [ __NR_getresuid ] = (syscall_handler_t *) sys_getresuid16, [ __NR_query_module ] = (syscall_handler_t *) sys_ni_syscall, [ __NR_poll ] = (syscall_handler_t *) sys_poll, - [ __NR_nfsservctl ] = (syscall_handler_t *) NFSSERVCTL, + [ __NR_nfsservctl ] = (syscall_handler_t *) sys_nfsservctl, [ __NR_setresgid ] = (syscall_handler_t *) sys_setresgid16, [ __NR_getresgid ] = (syscall_handler_t *) sys_getresgid16, [ __NR_prctl ] = (syscall_handler_t *) sys_prctl, -- cgit v1.2.3-59-g8ed1b From 6aec3072833283a5e2ecf07318bd383a67321657 Mon Sep 17 00:00:00 2001 From: Andree Leidenfrost Date: Sun, 1 May 2005 08:58:53 -0700 Subject: [PATCH] uml: fix handling of no fpx_regs Paolo 'Blaisorblade' Giarrusso Fix the error path, which is triggered when the processor misses the fpx regs (i.e. the "fxsr" cpuinfo feature). For instance by VIA C3 Samuel2. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/os-Linux/sys-i386/registers.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'arch/um') diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c index 148645b14480..9a0ad094d926 100644 --- a/arch/um/os-Linux/sys-i386/registers.c +++ b/arch/um/os-Linux/sys-i386/registers.c @@ -105,14 +105,15 @@ void init_registers(int pid) panic("check_ptrace : PTRACE_GETREGS failed, errno = %d", err); + errno = 0; err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs); if(!err) return; + if(errno != EIO) + panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d", + errno); have_fpx_regs = 0; - if(err != EIO) - panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d", - err); err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs); if(err) -- cgit v1.2.3-59-g8ed1b From b05d85a87d9711f5f5f2eb05c79038d5d5ff1f44 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 1 May 2005 08:58:54 -0700 Subject: [PATCH] uml: workaround old problematic sed behaviour Old versions of sed from 1998 (predating the first release of gcc 2.95, but still in use by debian stable) don't understand the single-line version of the sed append command. Since newer versions of sed still understand the... ahem, "vintage" form of the command, change our code to use that. Signed-off-by: Rob Landley Acked-by: Ian McDonald Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/kernel/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/um') diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index dc796c1bf39e..280d3000111b 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile @@ -53,6 +53,7 @@ quiet_cmd_quote2 = QUOTE $@ cmd_quote2 = sed -e '/CONFIG/{' \ -e 's/"CONFIG"\;/""/' \ -e 'r $(obj)/config.tmp' \ - -e 'a""\;' \ + -e 'a \' \ + -e '""\;' \ -e '}' \ $< > $@ -- cgit v1.2.3-59-g8ed1b From c45166be3cc666ce88fe623ad79276c943e74eff Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 1 May 2005 08:58:54 -0700 Subject: [PATCH] uml: support AES i586 crypto driver We want to make possible, for the user, to enable the i586 AES implementation. This requires a restructure. - Add a CONFIG_UML_X86 to notify that we are building a UML for i386. - Rename CONFIG_64_BIT to CONFIG_64BIT as is used for all other archs - Tell crypto/Kconfig that UML_X86 is as good as X86 - Tell it that it must exclude not X86_64 but 64BIT, which will give the same results. - Tell kbuild to descend down into arch/i386/crypto/ to build what's needed. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/Kconfig | 1 + arch/um/Kconfig_i386 | 6 +++++- arch/um/Kconfig_x86_64 | 6 +++++- arch/um/Makefile-i386 | 2 +- arch/um/defconfig | 10 +++++----- crypto/Kconfig | 4 ++-- include/asm-um/elf.h | 2 +- include/asm-um/page.h | 2 +- include/asm-um/pgtable-3level.h | 2 +- 9 files changed, 22 insertions(+), 13 deletions(-) (limited to 'arch/um') diff --git a/arch/um/Kconfig b/arch/um/Kconfig index 9a23df182123..c5292181a664 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig @@ -244,6 +244,7 @@ config KERNEL_HALF_GIGS config HIGHMEM bool "Highmem support" + depends on !64BIT config KERNEL_STACK_ORDER int "Kernel stack size order" diff --git a/arch/um/Kconfig_i386 b/arch/um/Kconfig_i386 index 203c242201b6..e41f3748d30f 100644 --- a/arch/um/Kconfig_i386 +++ b/arch/um/Kconfig_i386 @@ -1,4 +1,8 @@ -config 64_BIT +config UML_X86 + bool + default y + +config 64BIT bool default n diff --git a/arch/um/Kconfig_x86_64 b/arch/um/Kconfig_x86_64 index 768dc6626a8d..fd8d7e8982b1 100644 --- a/arch/um/Kconfig_x86_64 +++ b/arch/um/Kconfig_x86_64 @@ -1,4 +1,8 @@ -config 64_BIT +config UML_X86 + bool + default y + +config 64BIT bool default y diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 index 97b223bfa78e..f9e3c0f06541 100644 --- a/arch/um/Makefile-i386 +++ b/arch/um/Makefile-i386 @@ -1,4 +1,4 @@ -SUBARCH_CORE := arch/um/sys-i386/ +SUBARCH_CORE := arch/um/sys-i386/ arch/i386/crypto/ TOP_ADDR := $(CONFIG_TOP_ADDR) diff --git a/arch/um/defconfig b/arch/um/defconfig index fc3075c589d8..4067c3aa5b60 100644 --- a/arch/um/defconfig +++ b/arch/um/defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.12-rc1-bk1 -# Sun Mar 20 16:53:00 2005 +# Linux kernel version: 2.6.12-rc3-skas3-v9-pre2 +# Sun Apr 24 19:46:10 2005 # CONFIG_GENERIC_HARDIRQS=y CONFIG_UML=y @@ -15,7 +15,8 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y # CONFIG_MODE_TT=y CONFIG_MODE_SKAS=y -# CONFIG_64_BIT is not set +CONFIG_UML_X86=y +# CONFIG_64BIT is not set CONFIG_TOP_ADDR=0xc0000000 # CONFIG_3_LEVEL_PGTABLES is not set CONFIG_ARCH_HAS_SC_SIGNALS=y @@ -41,6 +42,7 @@ CONFIG_UML_REAL_TIME_CLOCK=y CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 # # General setup @@ -158,7 +160,6 @@ CONFIG_UML_NET_SLIRP=y # CONFIG_PACKET=y CONFIG_PACKET_MMAP=y -# CONFIG_NETLINK_DEV is not set CONFIG_UNIX=y # CONFIG_NET_KEY is not set CONFIG_INET=y @@ -412,6 +413,5 @@ CONFIG_DEBUG_INFO=y # CONFIG_DEBUG_FS is not set CONFIG_FRAME_POINTER=y CONFIG_PT_PROXY=y -# CONFIG_GPROF is not set # CONFIG_GCOV is not set # CONFIG_SYSCALL_DEBUG is not set diff --git a/crypto/Kconfig b/crypto/Kconfig index 536754faf4d2..90d6089d60ed 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -146,7 +146,7 @@ config CRYPTO_SERPENT config CRYPTO_AES tristate "AES cipher algorithms" - depends on CRYPTO && !(X86 && !X86_64) + depends on CRYPTO && !((X86 || UML_X86) && !64BIT) help AES cipher algorithms (FIPS-197). AES uses the Rijndael algorithm. @@ -166,7 +166,7 @@ config CRYPTO_AES config CRYPTO_AES_586 tristate "AES cipher algorithms (i586)" - depends on CRYPTO && (X86 && !X86_64) + depends on CRYPTO && ((X86 || UML_X86) && !64BIT) help AES cipher algorithms (FIPS-197). AES uses the Rijndael algorithm. diff --git a/include/asm-um/elf.h b/include/asm-um/elf.h index b3a7258f9971..7908f8fe8231 100644 --- a/include/asm-um/elf.h +++ b/include/asm-um/elf.h @@ -13,7 +13,7 @@ extern long elf_aux_hwcap; #define elf_check_arch(x) (1) -#ifdef CONFIG_64_BIT +#ifdef CONFIG_64BIT #define ELF_CLASS ELFCLASS64 #else #define ELF_CLASS ELFCLASS32 diff --git a/include/asm-um/page.h b/include/asm-um/page.h index 3620a08dc9f3..102eb3df1aaf 100644 --- a/include/asm-um/page.h +++ b/include/asm-um/page.h @@ -27,7 +27,7 @@ struct page; #define clear_user_page(page, vaddr, pg) clear_page(page) #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) -#if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64_BIT) +#if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT) typedef struct { unsigned long pte_low, pte_high; } pte_t; typedef struct { unsigned long long pmd; } pmd_t; diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h index bdbc3f97e20b..d309f3a9e6f6 100644 --- a/include/asm-um/pgtable-3level.h +++ b/include/asm-um/pgtable-3level.h @@ -145,7 +145,7 @@ static inline pmd_t pfn_pmd(pfn_t page_nr, pgprot_t pgprot) */ #define PTE_FILE_MAX_BITS 32 -#ifdef CONFIG_64_BIT +#ifdef CONFIG_64BIT #define pte_to_pgoff(p) ((p).pte >> 32) -- cgit v1.2.3-59-g8ed1b From c16993d9009b4311f0e6088af38844eabc8b5e5b Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 1 May 2005 08:58:54 -0700 Subject: [PATCH] uml: inline empty proc Cleanup: make an inline of this empty proc. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/kernel/process_kern.c | 4 ---- include/asm-um/processor-generic.h | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'arch/um') diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c index 1d719d5b4bb9..7a943696f950 100644 --- a/arch/um/kernel/process_kern.c +++ b/arch/um/kernel/process_kern.c @@ -161,10 +161,6 @@ void *get_current(void) return(current); } -void prepare_to_copy(struct task_struct *tsk) -{ -} - int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, unsigned long stack_top, struct task_struct * p, struct pt_regs *regs) diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h index 038ba6fc88b8..4d9404989b5a 100644 --- a/include/asm-um/processor-generic.h +++ b/include/asm-um/processor-generic.h @@ -89,7 +89,11 @@ extern struct task_struct *alloc_task_struct(void); extern void release_thread(struct task_struct *); extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); extern void dump_thread(struct pt_regs *regs, struct user *u); -extern void prepare_to_copy(struct task_struct *tsk); + +static inline void prepare_to_copy(struct task_struct *tsk) +{ +} + extern unsigned long thread_saved_pc(struct task_struct *t); -- cgit v1.2.3-59-g8ed1b From e9c527163d31da9f616e989a90429729525c5233 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 1 May 2005 08:58:54 -0700 Subject: [PATCH] uml: move va_copy conditional def GCC 2.95 uses __va_copy instead of va_copy. Handle it inside compiler.h instead of in a casual file, and avoid the risk that this breaks with a newer compiler (which it could do). Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/kernel/skas/uaccess.c | 4 ++-- include/linux/compiler-gcc2.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'arch/um') diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c index 7575ec489b63..f7da9d027672 100644 --- a/arch/um/kernel/skas/uaccess.c +++ b/arch/um/kernel/skas/uaccess.c @@ -3,6 +3,7 @@ * Licensed under the GPL */ +#include "linux/compiler.h" #include "linux/stddef.h" #include "linux/kernel.h" #include "linux/string.h" @@ -61,8 +62,7 @@ static void do_buffer_op(void *jmpbuf, void *arg_ptr) void *arg; int *res; - /* Some old gccs recognize __va_copy, but not va_copy */ - __va_copy(args, *(va_list *)arg_ptr); + va_copy(args, *(va_list *)arg_ptr); addr = va_arg(args, unsigned long); len = va_arg(args, int); is_write = va_arg(args, int); diff --git a/include/linux/compiler-gcc2.h b/include/linux/compiler-gcc2.h index 5a359153ffd9..ebed17660c5f 100644 --- a/include/linux/compiler-gcc2.h +++ b/include/linux/compiler-gcc2.h @@ -22,3 +22,8 @@ # define __attribute_pure__ __attribute__((pure)) # define __attribute_const__ __attribute__((__const__)) #endif + +/* GCC 2.95.x/2.96 recognize __va_copy, but not va_copy. Actually later GCC's + * define both va_copy and __va_copy, but the latter may go away, so limit this + * to this header */ +#define va_copy __va_copy -- cgit v1.2.3-59-g8ed1b From 5e7b83ffc67e15791d9bf8b2a18e4f5fd0eb69b8 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 1 May 2005 08:58:55 -0700 Subject: [PATCH] uml: fix syscall table by including $(SUBARCH)'s one, for i386 Split the i386 entry.S files into entry.S and syscall_table.S which is included in the previous one (so actually there is no difference between them) and use the syscall_table.S in the UML build, instead of tracking by hand the syscall table changes (which is inherently error-prone). We must only insert the right #defines to inject the changes we need from the i386 syscall table (for instance some different function names); also, we don't implement some i386 syscalls, as ioperm(), nor some TLS-related ones (yet to provide). Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/i386/kernel/entry.S | 292 +------------------------------ arch/i386/kernel/syscall_table.S | 291 ++++++++++++++++++++++++++++++ arch/um/include/sysdep-i386/syscalls.h | 99 ----------- arch/um/include/sysdep-x86_64/syscalls.h | 11 -- arch/um/kernel/Makefile | 2 +- arch/um/kernel/sys_call_table.c | 270 ---------------------------- arch/um/sys-i386/Makefile | 3 +- arch/um/sys-i386/sys_call_table.S | 16 ++ arch/um/sys-x86_64/Makefile | 2 +- arch/um/sys-x86_64/sys_call_table.c | 276 +++++++++++++++++++++++++++++ 10 files changed, 588 insertions(+), 674 deletions(-) create mode 100644 arch/i386/kernel/syscall_table.S delete mode 100644 arch/um/kernel/sys_call_table.c create mode 100644 arch/um/sys-i386/sys_call_table.S create mode 100644 arch/um/sys-x86_64/sys_call_table.c (limited to 'arch/um') diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index 25bf7589e0c4..a991d4e5edd2 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S @@ -652,296 +652,6 @@ ENTRY(spurious_interrupt_bug) pushl $do_spurious_interrupt_bug jmp error_code -.data -ENTRY(sys_call_table) - .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ - .long sys_exit - .long sys_fork - .long sys_read - .long sys_write - .long sys_open /* 5 */ - .long sys_close - .long sys_waitpid - .long sys_creat - .long sys_link - .long sys_unlink /* 10 */ - .long sys_execve - .long sys_chdir - .long sys_time - .long sys_mknod - .long sys_chmod /* 15 */ - .long sys_lchown16 - .long sys_ni_syscall /* old break syscall holder */ - .long sys_stat - .long sys_lseek - .long sys_getpid /* 20 */ - .long sys_mount - .long sys_oldumount - .long sys_setuid16 - .long sys_getuid16 - .long sys_stime /* 25 */ - .long sys_ptrace - .long sys_alarm - .long sys_fstat - .long sys_pause - .long sys_utime /* 30 */ - .long sys_ni_syscall /* old stty syscall holder */ - .long sys_ni_syscall /* old gtty syscall holder */ - .long sys_access - .long sys_nice - .long sys_ni_syscall /* 35 - old ftime syscall holder */ - .long sys_sync - .long sys_kill - .long sys_rename - .long sys_mkdir - .long sys_rmdir /* 40 */ - .long sys_dup - .long sys_pipe - .long sys_times - .long sys_ni_syscall /* old prof syscall holder */ - .long sys_brk /* 45 */ - .long sys_setgid16 - .long sys_getgid16 - .long sys_signal - .long sys_geteuid16 - .long sys_getegid16 /* 50 */ - .long sys_acct - .long sys_umount /* recycled never used phys() */ - .long sys_ni_syscall /* old lock syscall holder */ - .long sys_ioctl - .long sys_fcntl /* 55 */ - .long sys_ni_syscall /* old mpx syscall holder */ - .long sys_setpgid - .long sys_ni_syscall /* old ulimit syscall holder */ - .long sys_olduname - .long sys_umask /* 60 */ - .long sys_chroot - .long sys_ustat - .long sys_dup2 - .long sys_getppid - .long sys_getpgrp /* 65 */ - .long sys_setsid - .long sys_sigaction - .long sys_sgetmask - .long sys_ssetmask - .long sys_setreuid16 /* 70 */ - .long sys_setregid16 - .long sys_sigsuspend - .long sys_sigpending - .long sys_sethostname - .long sys_setrlimit /* 75 */ - .long sys_old_getrlimit - .long sys_getrusage - .long sys_gettimeofday - .long sys_settimeofday - .long sys_getgroups16 /* 80 */ - .long sys_setgroups16 - .long old_select - .long sys_symlink - .long sys_lstat - .long sys_readlink /* 85 */ - .long sys_uselib - .long sys_swapon - .long sys_reboot - .long old_readdir - .long old_mmap /* 90 */ - .long sys_munmap - .long sys_truncate - .long sys_ftruncate - .long sys_fchmod - .long sys_fchown16 /* 95 */ - .long sys_getpriority - .long sys_setpriority - .long sys_ni_syscall /* old profil syscall holder */ - .long sys_statfs - .long sys_fstatfs /* 100 */ - .long sys_ioperm - .long sys_socketcall - .long sys_syslog - .long sys_setitimer - .long sys_getitimer /* 105 */ - .long sys_newstat - .long sys_newlstat - .long sys_newfstat - .long sys_uname - .long sys_iopl /* 110 */ - .long sys_vhangup - .long sys_ni_syscall /* old "idle" system call */ - .long sys_vm86old - .long sys_wait4 - .long sys_swapoff /* 115 */ - .long sys_sysinfo - .long sys_ipc - .long sys_fsync - .long sys_sigreturn - .long sys_clone /* 120 */ - .long sys_setdomainname - .long sys_newuname - .long sys_modify_ldt - .long sys_adjtimex - .long sys_mprotect /* 125 */ - .long sys_sigprocmask - .long sys_ni_syscall /* old "create_module" */ - .long sys_init_module - .long sys_delete_module - .long sys_ni_syscall /* 130: old "get_kernel_syms" */ - .long sys_quotactl - .long sys_getpgid - .long sys_fchdir - .long sys_bdflush - .long sys_sysfs /* 135 */ - .long sys_personality - .long sys_ni_syscall /* reserved for afs_syscall */ - .long sys_setfsuid16 - .long sys_setfsgid16 - .long sys_llseek /* 140 */ - .long sys_getdents - .long sys_select - .long sys_flock - .long sys_msync - .long sys_readv /* 145 */ - .long sys_writev - .long sys_getsid - .long sys_fdatasync - .long sys_sysctl - .long sys_mlock /* 150 */ - .long sys_munlock - .long sys_mlockall - .long sys_munlockall - .long sys_sched_setparam - .long sys_sched_getparam /* 155 */ - .long sys_sched_setscheduler - .long sys_sched_getscheduler - .long sys_sched_yield - .long sys_sched_get_priority_max - .long sys_sched_get_priority_min /* 160 */ - .long sys_sched_rr_get_interval - .long sys_nanosleep - .long sys_mremap - .long sys_setresuid16 - .long sys_getresuid16 /* 165 */ - .long sys_vm86 - .long sys_ni_syscall /* Old sys_query_module */ - .long sys_poll - .long sys_nfsservctl - .long sys_setresgid16 /* 170 */ - .long sys_getresgid16 - .long sys_prctl - .long sys_rt_sigreturn - .long sys_rt_sigaction - .long sys_rt_sigprocmask /* 175 */ - .long sys_rt_sigpending - .long sys_rt_sigtimedwait - .long sys_rt_sigqueueinfo - .long sys_rt_sigsuspend - .long sys_pread64 /* 180 */ - .long sys_pwrite64 - .long sys_chown16 - .long sys_getcwd - .long sys_capget - .long sys_capset /* 185 */ - .long sys_sigaltstack - .long sys_sendfile - .long sys_ni_syscall /* reserved for streams1 */ - .long sys_ni_syscall /* reserved for streams2 */ - .long sys_vfork /* 190 */ - .long sys_getrlimit - .long sys_mmap2 - .long sys_truncate64 - .long sys_ftruncate64 - .long sys_stat64 /* 195 */ - .long sys_lstat64 - .long sys_fstat64 - .long sys_lchown - .long sys_getuid - .long sys_getgid /* 200 */ - .long sys_geteuid - .long sys_getegid - .long sys_setreuid - .long sys_setregid - .long sys_getgroups /* 205 */ - .long sys_setgroups - .long sys_fchown - .long sys_setresuid - .long sys_getresuid - .long sys_setresgid /* 210 */ - .long sys_getresgid - .long sys_chown - .long sys_setuid - .long sys_setgid - .long sys_setfsuid /* 215 */ - .long sys_setfsgid - .long sys_pivot_root - .long sys_mincore - .long sys_madvise - .long sys_getdents64 /* 220 */ - .long sys_fcntl64 - .long sys_ni_syscall /* reserved for TUX */ - .long sys_ni_syscall - .long sys_gettid - .long sys_readahead /* 225 */ - .long sys_setxattr - .long sys_lsetxattr - .long sys_fsetxattr - .long sys_getxattr - .long sys_lgetxattr /* 230 */ - .long sys_fgetxattr - .long sys_listxattr - .long sys_llistxattr - .long sys_flistxattr - .long sys_removexattr /* 235 */ - .long sys_lremovexattr - .long sys_fremovexattr - .long sys_tkill - .long sys_sendfile64 - .long sys_futex /* 240 */ - .long sys_sched_setaffinity - .long sys_sched_getaffinity - .long sys_set_thread_area - .long sys_get_thread_area - .long sys_io_setup /* 245 */ - .long sys_io_destroy - .long sys_io_getevents - .long sys_io_submit - .long sys_io_cancel - .long sys_fadvise64 /* 250 */ - .long sys_ni_syscall - .long sys_exit_group - .long sys_lookup_dcookie - .long sys_epoll_create - .long sys_epoll_ctl /* 255 */ - .long sys_epoll_wait - .long sys_remap_file_pages - .long sys_set_tid_address - .long sys_timer_create - .long sys_timer_settime /* 260 */ - .long sys_timer_gettime - .long sys_timer_getoverrun - .long sys_timer_delete - .long sys_clock_settime - .long sys_clock_gettime /* 265 */ - .long sys_clock_getres - .long sys_clock_nanosleep - .long sys_statfs64 - .long sys_fstatfs64 - .long sys_tgkill /* 270 */ - .long sys_utimes - .long sys_fadvise64_64 - .long sys_ni_syscall /* sys_vserver */ - .long sys_mbind - .long sys_get_mempolicy - .long sys_set_mempolicy - .long sys_mq_open - .long sys_mq_unlink - .long sys_mq_timedsend - .long sys_mq_timedreceive /* 280 */ - .long sys_mq_notify - .long sys_mq_getsetattr - .long sys_ni_syscall /* reserved for kexec */ - .long sys_waitid - .long sys_ni_syscall /* 285 */ /* available */ - .long sys_add_key - .long sys_request_key - .long sys_keyctl +#include "syscall_table.S" syscall_table_size=(.-sys_call_table) diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S new file mode 100644 index 000000000000..6cd1ed311f02 --- /dev/null +++ b/arch/i386/kernel/syscall_table.S @@ -0,0 +1,291 @@ +.data +ENTRY(sys_call_table) + .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ + .long sys_exit + .long sys_fork + .long sys_read + .long sys_write + .long sys_open /* 5 */ + .long sys_close + .long sys_waitpid + .long sys_creat + .long sys_link + .long sys_unlink /* 10 */ + .long sys_execve + .long sys_chdir + .long sys_time + .long sys_mknod + .long sys_chmod /* 15 */ + .long sys_lchown16 + .long sys_ni_syscall /* old break syscall holder */ + .long sys_stat + .long sys_lseek + .long sys_getpid /* 20 */ + .long sys_mount + .long sys_oldumount + .long sys_setuid16 + .long sys_getuid16 + .long sys_stime /* 25 */ + .long sys_ptrace + .long sys_alarm + .long sys_fstat + .long sys_pause + .long sys_utime /* 30 */ + .long sys_ni_syscall /* old stty syscall holder */ + .long sys_ni_syscall /* old gtty syscall holder */ + .long sys_access + .long sys_nice + .long sys_ni_syscall /* 35 - old ftime syscall holder */ + .long sys_sync + .long sys_kill + .long sys_rename + .long sys_mkdir + .long sys_rmdir /* 40 */ + .long sys_dup + .long sys_pipe + .long sys_times + .long sys_ni_syscall /* old prof syscall holder */ + .long sys_brk /* 45 */ + .long sys_setgid16 + .long sys_getgid16 + .long sys_signal + .long sys_geteuid16 + .long sys_getegid16 /* 50 */ + .long sys_acct + .long sys_umount /* recycled never used phys() */ + .long sys_ni_syscall /* old lock syscall holder */ + .long sys_ioctl + .long sys_fcntl /* 55 */ + .long sys_ni_syscall /* old mpx syscall holder */ + .long sys_setpgid + .long sys_ni_syscall /* old ulimit syscall holder */ + .long sys_olduname + .long sys_umask /* 60 */ + .long sys_chroot + .long sys_ustat + .long sys_dup2 + .long sys_getppid + .long sys_getpgrp /* 65 */ + .long sys_setsid + .long sys_sigaction + .long sys_sgetmask + .long sys_ssetmask + .long sys_setreuid16 /* 70 */ + .long sys_setregid16 + .long sys_sigsuspend + .long sys_sigpending + .long sys_sethostname + .long sys_setrlimit /* 75 */ + .long sys_old_getrlimit + .long sys_getrusage + .long sys_gettimeofday + .long sys_settimeofday + .long sys_getgroups16 /* 80 */ + .long sys_setgroups16 + .long old_select + .long sys_symlink + .long sys_lstat + .long sys_readlink /* 85 */ + .long sys_uselib + .long sys_swapon + .long sys_reboot + .long old_readdir + .long old_mmap /* 90 */ + .long sys_munmap + .long sys_truncate + .long sys_ftruncate + .long sys_fchmod + .long sys_fchown16 /* 95 */ + .long sys_getpriority + .long sys_setpriority + .long sys_ni_syscall /* old profil syscall holder */ + .long sys_statfs + .long sys_fstatfs /* 100 */ + .long sys_ioperm + .long sys_socketcall + .long sys_syslog + .long sys_setitimer + .long sys_getitimer /* 105 */ + .long sys_newstat + .long sys_newlstat + .long sys_newfstat + .long sys_uname + .long sys_iopl /* 110 */ + .long sys_vhangup + .long sys_ni_syscall /* old "idle" system call */ + .long sys_vm86old + .long sys_wait4 + .long sys_swapoff /* 115 */ + .long sys_sysinfo + .long sys_ipc + .long sys_fsync + .long sys_sigreturn + .long sys_clone /* 120 */ + .long sys_setdomainname + .long sys_newuname + .long sys_modify_ldt + .long sys_adjtimex + .long sys_mprotect /* 125 */ + .long sys_sigprocmask + .long sys_ni_syscall /* old "create_module" */ + .long sys_init_module + .long sys_delete_module + .long sys_ni_syscall /* 130: old "get_kernel_syms" */ + .long sys_quotactl + .long sys_getpgid + .long sys_fchdir + .long sys_bdflush + .long sys_sysfs /* 135 */ + .long sys_personality + .long sys_ni_syscall /* reserved for afs_syscall */ + .long sys_setfsuid16 + .long sys_setfsgid16 + .long sys_llseek /* 140 */ + .long sys_getdents + .long sys_select + .long sys_flock + .long sys_msync + .long sys_readv /* 145 */ + .long sys_writev + .long sys_getsid + .long sys_fdatasync + .long sys_sysctl + .long sys_mlock /* 150 */ + .long sys_munlock + .long sys_mlockall + .long sys_munlockall + .long sys_sched_setparam + .long sys_sched_getparam /* 155 */ + .long sys_sched_setscheduler + .long sys_sched_getscheduler + .long sys_sched_yield + .long sys_sched_get_priority_max + .long sys_sched_get_priority_min /* 160 */ + .long sys_sched_rr_get_interval + .long sys_nanosleep + .long sys_mremap + .long sys_setresuid16 + .long sys_getresuid16 /* 165 */ + .long sys_vm86 + .long sys_ni_syscall /* Old sys_query_module */ + .long sys_poll + .long sys_nfsservctl + .long sys_setresgid16 /* 170 */ + .long sys_getresgid16 + .long sys_prctl + .long sys_rt_sigreturn + .long sys_rt_sigaction + .long sys_rt_sigprocmask /* 175 */ + .long sys_rt_sigpending + .long sys_rt_sigtimedwait + .long sys_rt_sigqueueinfo + .long sys_rt_sigsuspend + .long sys_pread64 /* 180 */ + .long sys_pwrite64 + .long sys_chown16 + .long sys_getcwd + .long sys_capget + .long sys_capset /* 185 */ + .long sys_sigaltstack + .long sys_sendfile + .long sys_ni_syscall /* reserved for streams1 */ + .long sys_ni_syscall /* reserved for streams2 */ + .long sys_vfork /* 190 */ + .long sys_getrlimit + .long sys_mmap2 + .long sys_truncate64 + .long sys_ftruncate64 + .long sys_stat64 /* 195 */ + .long sys_lstat64 + .long sys_fstat64 + .long sys_lchown + .long sys_getuid + .long sys_getgid /* 200 */ + .long sys_geteuid + .long sys_getegid + .long sys_setreuid + .long sys_setregid + .long sys_getgroups /* 205 */ + .long sys_setgroups + .long sys_fchown + .long sys_setresuid + .long sys_getresuid + .long sys_setresgid /* 210 */ + .long sys_getresgid + .long sys_chown + .long sys_setuid + .long sys_setgid + .long sys_setfsuid /* 215 */ + .long sys_setfsgid + .long sys_pivot_root + .long sys_mincore + .long sys_madvise + .long sys_getdents64 /* 220 */ + .long sys_fcntl64 + .long sys_ni_syscall /* reserved for TUX */ + .long sys_ni_syscall + .long sys_gettid + .long sys_readahead /* 225 */ + .long sys_setxattr + .long sys_lsetxattr + .long sys_fsetxattr + .long sys_getxattr + .long sys_lgetxattr /* 230 */ + .long sys_fgetxattr + .long sys_listxattr + .long sys_llistxattr + .long sys_flistxattr + .long sys_removexattr /* 235 */ + .long sys_lremovexattr + .long sys_fremovexattr + .long sys_tkill + .long sys_sendfile64 + .long sys_futex /* 240 */ + .long sys_sched_setaffinity + .long sys_sched_getaffinity + .long sys_set_thread_area + .long sys_get_thread_area + .long sys_io_setup /* 245 */ + .long sys_io_destroy + .long sys_io_getevents + .long sys_io_submit + .long sys_io_cancel + .long sys_fadvise64 /* 250 */ + .long sys_ni_syscall + .long sys_exit_group + .long sys_lookup_dcookie + .long sys_epoll_create + .long sys_epoll_ctl /* 255 */ + .long sys_epoll_wait + .long sys_remap_file_pages + .long sys_set_tid_address + .long sys_timer_create + .long sys_timer_settime /* 260 */ + .long sys_timer_gettime + .long sys_timer_getoverrun + .long sys_timer_delete + .long sys_clock_settime + .long sys_clock_gettime /* 265 */ + .long sys_clock_getres + .long sys_clock_nanosleep + .long sys_statfs64 + .long sys_fstatfs64 + .long sys_tgkill /* 270 */ + .long sys_utimes + .long sys_fadvise64_64 + .long sys_ni_syscall /* sys_vserver */ + .long sys_mbind + .long sys_get_mempolicy + .long sys_set_mempolicy + .long sys_mq_open + .long sys_mq_unlink + .long sys_mq_timedsend + .long sys_mq_timedreceive /* 280 */ + .long sys_mq_notify + .long sys_mq_getsetattr + .long sys_ni_syscall /* reserved for kexec */ + .long sys_waitid + .long sys_ni_syscall /* 285 */ /* available */ + .long sys_add_key + .long sys_request_key + .long sys_keyctl diff --git a/arch/um/include/sysdep-i386/syscalls.h b/arch/um/include/sysdep-i386/syscalls.h index 5db81ec9087d..be0a3e3469eb 100644 --- a/arch/um/include/sysdep-i386/syscalls.h +++ b/arch/um/include/sysdep-i386/syscalls.h @@ -22,102 +22,3 @@ extern syscall_handler_t old_mmap_i386; extern long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff); - -/* On i386 they choose a meaningless naming.*/ -#define __NR_kexec_load __NR_sys_kexec_load - -#define ARCH_SYSCALLS \ - [ __NR_waitpid ] = (syscall_handler_t *) sys_waitpid, \ - [ __NR_break ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_oldstat ] = (syscall_handler_t *) sys_stat, \ - [ __NR_umount ] = (syscall_handler_t *) sys_oldumount, \ - [ __NR_stime ] = um_stime, \ - [ __NR_oldfstat ] = (syscall_handler_t *) sys_fstat, \ - [ __NR_stty ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_gtty ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_nice ] = (syscall_handler_t *) sys_nice, \ - [ __NR_ftime ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_prof ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_signal ] = (syscall_handler_t *) sys_signal, \ - [ __NR_lock ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_mpx ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_ulimit ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_oldolduname ] = (syscall_handler_t *) sys_olduname, \ - [ __NR_sigaction ] = (syscall_handler_t *) sys_sigaction, \ - [ __NR_sgetmask ] = (syscall_handler_t *) sys_sgetmask, \ - [ __NR_ssetmask ] = (syscall_handler_t *) sys_ssetmask, \ - [ __NR_sigsuspend ] = (syscall_handler_t *) sys_sigsuspend, \ - [ __NR_sigpending ] = (syscall_handler_t *) sys_sigpending, \ - [ __NR_oldlstat ] = (syscall_handler_t *) sys_lstat, \ - [ __NR_readdir ] = old_readdir, \ - [ __NR_profil ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_socketcall ] = (syscall_handler_t *) sys_socketcall, \ - [ __NR_olduname ] = (syscall_handler_t *) sys_uname, \ - [ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_idle ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_ipc ] = (syscall_handler_t *) sys_ipc, \ - [ __NR_sigreturn ] = (syscall_handler_t *) sys_sigreturn, \ - [ __NR_sigprocmask ] = (syscall_handler_t *) sys_sigprocmask, \ - [ __NR_bdflush ] = (syscall_handler_t *) sys_bdflush, \ - [ __NR__llseek ] = (syscall_handler_t *) sys_llseek, \ - [ __NR__newselect ] = (syscall_handler_t *) sys_select, \ - [ __NR_vm86 ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_mmap ] = (syscall_handler_t *) old_mmap_i386, \ - [ __NR_ugetrlimit ] = (syscall_handler_t *) sys_getrlimit, \ - [ __NR_mmap2 ] = (syscall_handler_t *) sys_mmap2, \ - [ __NR_truncate64 ] = (syscall_handler_t *) sys_truncate64, \ - [ __NR_ftruncate64 ] = (syscall_handler_t *) sys_ftruncate64, \ - [ __NR_stat64 ] = (syscall_handler_t *) sys_stat64, \ - [ __NR_lstat64 ] = (syscall_handler_t *) sys_lstat64, \ - [ __NR_fstat64 ] = (syscall_handler_t *) sys_fstat64, \ - [ __NR_fcntl64 ] = (syscall_handler_t *) sys_fcntl64, \ - [ __NR_sendfile64 ] = (syscall_handler_t *) sys_sendfile64, \ - [ __NR_statfs64 ] = (syscall_handler_t *) sys_statfs64, \ - [ __NR_fstatfs64 ] = (syscall_handler_t *) sys_fstatfs64, \ - [ __NR_fadvise64_64 ] = (syscall_handler_t *) sys_fadvise64_64, \ - [ __NR_select ] = (syscall_handler_t *) old_select, \ - [ __NR_vm86old ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_modify_ldt ] = (syscall_handler_t *) sys_modify_ldt, \ - [ __NR_lchown32 ] = (syscall_handler_t *) sys_lchown, \ - [ __NR_getuid32 ] = (syscall_handler_t *) sys_getuid, \ - [ __NR_getgid32 ] = (syscall_handler_t *) sys_getgid, \ - [ __NR_geteuid32 ] = (syscall_handler_t *) sys_geteuid, \ - [ __NR_getegid32 ] = (syscall_handler_t *) sys_getegid, \ - [ __NR_setreuid32 ] = (syscall_handler_t *) sys_setreuid, \ - [ __NR_setregid32 ] = (syscall_handler_t *) sys_setregid, \ - [ __NR_getgroups32 ] = (syscall_handler_t *) sys_getgroups, \ - [ __NR_setgroups32 ] = (syscall_handler_t *) sys_setgroups, \ - [ __NR_fchown32 ] = (syscall_handler_t *) sys_fchown, \ - [ __NR_setresuid32 ] = (syscall_handler_t *) sys_setresuid, \ - [ __NR_getresuid32 ] = (syscall_handler_t *) sys_getresuid, \ - [ __NR_setresgid32 ] = (syscall_handler_t *) sys_setresgid, \ - [ __NR_getresgid32 ] = (syscall_handler_t *) sys_getresgid, \ - [ __NR_chown32 ] = (syscall_handler_t *) sys_chown, \ - [ __NR_setuid32 ] = (syscall_handler_t *) sys_setuid, \ - [ __NR_setgid32 ] = (syscall_handler_t *) sys_setgid, \ - [ __NR_setfsuid32 ] = (syscall_handler_t *) sys_setfsuid, \ - [ __NR_setfsgid32 ] = (syscall_handler_t *) sys_setfsgid, \ - [ __NR_pivot_root ] = (syscall_handler_t *) sys_pivot_root, \ - [ __NR_mincore ] = (syscall_handler_t *) sys_mincore, \ - [ __NR_madvise ] = (syscall_handler_t *) sys_madvise, \ - [ 222 ] = (syscall_handler_t *) sys_ni_syscall, \ - [ 223 ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_set_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_get_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \ - [ 251 ] = (syscall_handler_t *) sys_ni_syscall, \ - [ 285 ] = (syscall_handler_t *) sys_ni_syscall, - -/* 222 doesn't yet have a name in include/asm-i386/unistd.h */ - -#define LAST_ARCH_SYSCALL 285 - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/arch/um/include/sysdep-x86_64/syscalls.h b/arch/um/include/sysdep-x86_64/syscalls.h index b187a4157ff3..65a01e3d8707 100644 --- a/arch/um/include/sysdep-x86_64/syscalls.h +++ b/arch/um/include/sysdep-x86_64/syscalls.h @@ -78,14 +78,3 @@ extern syscall_handler_t sys_arch_prctl; #define NR_syscalls 1024 #endif - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index 280d3000111b..246f0e7fb4cc 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile @@ -10,7 +10,7 @@ obj-y = checksum.o config.o exec_kern.o exitcode.o \ helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \ physmem.o process.o process_kern.o ptrace.o reboot.o resource.o \ sigio_user.o sigio_kern.o signal_kern.o signal_user.o smp.o \ - syscall_kern.o sysrq.o sys_call_table.o tempfile.o time.o time_kern.o \ + syscall_kern.o sysrq.o tempfile.o time.o time_kern.o \ tlb.o trap_kern.o trap_user.o uaccess_user.o um_arch.o umid.o \ user_util.o diff --git a/arch/um/kernel/sys_call_table.c b/arch/um/kernel/sys_call_table.c deleted file mode 100644 index b671a31a0069..000000000000 --- a/arch/um/kernel/sys_call_table.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) - * Copyright 2003 PathScale, Inc. - * Licensed under the GPL - */ - -#include "linux/config.h" -#include "linux/unistd.h" -#include "linux/sys.h" -#include "linux/swap.h" -#include "linux/syscalls.h" -#include "linux/sysctl.h" -#include "asm/signal.h" -#include "sysdep/syscalls.h" -#include "kern_util.h" - -#define LAST_GENERIC_SYSCALL __NR_keyctl - -#if LAST_GENERIC_SYSCALL > LAST_ARCH_SYSCALL -#define LAST_SYSCALL LAST_GENERIC_SYSCALL -#else -#define LAST_SYSCALL LAST_ARCH_SYSCALL -#endif - -extern syscall_handler_t sys_fork; -extern syscall_handler_t sys_execve; -extern syscall_handler_t um_time; -extern syscall_handler_t um_stime; -extern syscall_handler_t sys_pipe; -extern syscall_handler_t sys_olduname; -extern syscall_handler_t sys_sigaction; -extern syscall_handler_t sys_sigsuspend; -extern syscall_handler_t old_readdir; -extern syscall_handler_t sys_uname; -extern syscall_handler_t sys_ipc; -extern syscall_handler_t sys_sigreturn; -extern syscall_handler_t sys_clone; -extern syscall_handler_t sys_rt_sigreturn; -extern syscall_handler_t sys_sigaltstack; -extern syscall_handler_t sys_vfork; -extern syscall_handler_t old_select; -extern syscall_handler_t sys_modify_ldt; -extern syscall_handler_t sys_rt_sigsuspend; -extern syscall_handler_t sys_mbind; -extern syscall_handler_t sys_get_mempolicy; -extern syscall_handler_t sys_set_mempolicy; -extern syscall_handler_t sys_sys_setaltroot; - -syscall_handler_t *sys_call_table[] = { - [ __NR_restart_syscall ] = (syscall_handler_t *) sys_restart_syscall, - [ __NR_exit ] = (syscall_handler_t *) sys_exit, - [ __NR_fork ] = (syscall_handler_t *) sys_fork, - [ __NR_read ] = (syscall_handler_t *) sys_read, - [ __NR_write ] = (syscall_handler_t *) sys_write, - - /* These three are declared differently in asm/unistd.h */ - [ __NR_open ] = (syscall_handler_t *) sys_open, - [ __NR_close ] = (syscall_handler_t *) sys_close, - [ __NR_creat ] = (syscall_handler_t *) sys_creat, - [ __NR_link ] = (syscall_handler_t *) sys_link, - [ __NR_unlink ] = (syscall_handler_t *) sys_unlink, - [ __NR_execve ] = (syscall_handler_t *) sys_execve, - - /* declared differently in kern_util.h */ - [ __NR_chdir ] = (syscall_handler_t *) sys_chdir, - [ __NR_time ] = um_time, - [ __NR_mknod ] = (syscall_handler_t *) sys_mknod, - [ __NR_chmod ] = (syscall_handler_t *) sys_chmod, - [ __NR_lchown ] = (syscall_handler_t *) sys_lchown16, - [ __NR_lseek ] = (syscall_handler_t *) sys_lseek, - [ __NR_getpid ] = (syscall_handler_t *) sys_getpid, - [ __NR_mount ] = (syscall_handler_t *) sys_mount, - [ __NR_setuid ] = (syscall_handler_t *) sys_setuid16, - [ __NR_getuid ] = (syscall_handler_t *) sys_getuid16, - [ __NR_ptrace ] = (syscall_handler_t *) sys_ptrace, - [ __NR_alarm ] = (syscall_handler_t *) sys_alarm, - [ __NR_pause ] = (syscall_handler_t *) sys_pause, - [ __NR_utime ] = (syscall_handler_t *) sys_utime, - [ __NR_access ] = (syscall_handler_t *) sys_access, - [ __NR_sync ] = (syscall_handler_t *) sys_sync, - [ __NR_kill ] = (syscall_handler_t *) sys_kill, - [ __NR_rename ] = (syscall_handler_t *) sys_rename, - [ __NR_mkdir ] = (syscall_handler_t *) sys_mkdir, - [ __NR_rmdir ] = (syscall_handler_t *) sys_rmdir, - - /* Declared differently in asm/unistd.h */ - [ __NR_dup ] = (syscall_handler_t *) sys_dup, - [ __NR_pipe ] = (syscall_handler_t *) sys_pipe, - [ __NR_times ] = (syscall_handler_t *) sys_times, - [ __NR_brk ] = (syscall_handler_t *) sys_brk, - [ __NR_setgid ] = (syscall_handler_t *) sys_setgid16, - [ __NR_getgid ] = (syscall_handler_t *) sys_getgid16, - [ __NR_geteuid ] = (syscall_handler_t *) sys_geteuid16, - [ __NR_getegid ] = (syscall_handler_t *) sys_getegid16, - [ __NR_acct ] = (syscall_handler_t *) sys_acct, - [ __NR_umount2 ] = (syscall_handler_t *) sys_umount, - [ __NR_ioctl ] = (syscall_handler_t *) sys_ioctl, - [ __NR_fcntl ] = (syscall_handler_t *) sys_fcntl, - [ __NR_setpgid ] = (syscall_handler_t *) sys_setpgid, - [ __NR_umask ] = (syscall_handler_t *) sys_umask, - [ __NR_chroot ] = (syscall_handler_t *) sys_chroot, - [ __NR_ustat ] = (syscall_handler_t *) sys_ustat, - [ __NR_dup2 ] = (syscall_handler_t *) sys_dup2, - [ __NR_getppid ] = (syscall_handler_t *) sys_getppid, - [ __NR_getpgrp ] = (syscall_handler_t *) sys_getpgrp, - [ __NR_setsid ] = (syscall_handler_t *) sys_setsid, - [ __NR_setreuid ] = (syscall_handler_t *) sys_setreuid16, - [ __NR_setregid ] = (syscall_handler_t *) sys_setregid16, - [ __NR_sethostname ] = (syscall_handler_t *) sys_sethostname, - [ __NR_setrlimit ] = (syscall_handler_t *) sys_setrlimit, - [ __NR_getrlimit ] = (syscall_handler_t *) sys_old_getrlimit, - [ __NR_getrusage ] = (syscall_handler_t *) sys_getrusage, - [ __NR_gettimeofday ] = (syscall_handler_t *) sys_gettimeofday, - [ __NR_settimeofday ] = (syscall_handler_t *) sys_settimeofday, - [ __NR_getgroups ] = (syscall_handler_t *) sys_getgroups16, - [ __NR_setgroups ] = (syscall_handler_t *) sys_setgroups16, - [ __NR_symlink ] = (syscall_handler_t *) sys_symlink, - [ __NR_readlink ] = (syscall_handler_t *) sys_readlink, - [ __NR_uselib ] = (syscall_handler_t *) sys_uselib, - [ __NR_swapon ] = (syscall_handler_t *) sys_swapon, - [ __NR_reboot ] = (syscall_handler_t *) sys_reboot, - [ __NR_munmap ] = (syscall_handler_t *) sys_munmap, - [ __NR_truncate ] = (syscall_handler_t *) sys_truncate, - [ __NR_ftruncate ] = (syscall_handler_t *) sys_ftruncate, - [ __NR_fchmod ] = (syscall_handler_t *) sys_fchmod, - [ __NR_fchown ] = (syscall_handler_t *) sys_fchown16, - [ __NR_getpriority ] = (syscall_handler_t *) sys_getpriority, - [ __NR_setpriority ] = (syscall_handler_t *) sys_setpriority, - [ __NR_statfs ] = (syscall_handler_t *) sys_statfs, - [ __NR_fstatfs ] = (syscall_handler_t *) sys_fstatfs, - [ __NR_ioperm ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_syslog ] = (syscall_handler_t *) sys_syslog, - [ __NR_setitimer ] = (syscall_handler_t *) sys_setitimer, - [ __NR_getitimer ] = (syscall_handler_t *) sys_getitimer, - [ __NR_stat ] = (syscall_handler_t *) sys_newstat, - [ __NR_lstat ] = (syscall_handler_t *) sys_newlstat, - [ __NR_fstat ] = (syscall_handler_t *) sys_newfstat, - [ __NR_vhangup ] = (syscall_handler_t *) sys_vhangup, - [ __NR_wait4 ] = (syscall_handler_t *) sys_wait4, - [ __NR_swapoff ] = (syscall_handler_t *) sys_swapoff, - [ __NR_sysinfo ] = (syscall_handler_t *) sys_sysinfo, - [ __NR_fsync ] = (syscall_handler_t *) sys_fsync, - [ __NR_clone ] = (syscall_handler_t *) sys_clone, - [ __NR_setdomainname ] = (syscall_handler_t *) sys_setdomainname, - [ __NR_uname ] = (syscall_handler_t *) sys_newuname, - [ __NR_adjtimex ] = (syscall_handler_t *) sys_adjtimex, - [ __NR_mprotect ] = (syscall_handler_t *) sys_mprotect, - [ __NR_create_module ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_init_module ] = (syscall_handler_t *) sys_init_module, - [ __NR_delete_module ] = (syscall_handler_t *) sys_delete_module, - [ __NR_get_kernel_syms ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_quotactl ] = (syscall_handler_t *) sys_quotactl, - [ __NR_getpgid ] = (syscall_handler_t *) sys_getpgid, - [ __NR_fchdir ] = (syscall_handler_t *) sys_fchdir, - [ __NR_sysfs ] = (syscall_handler_t *) sys_sysfs, - [ __NR_personality ] = (syscall_handler_t *) sys_personality, - [ __NR_afs_syscall ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_setfsuid ] = (syscall_handler_t *) sys_setfsuid16, - [ __NR_setfsgid ] = (syscall_handler_t *) sys_setfsgid16, - [ __NR_getdents ] = (syscall_handler_t *) sys_getdents, - [ __NR_flock ] = (syscall_handler_t *) sys_flock, - [ __NR_msync ] = (syscall_handler_t *) sys_msync, - [ __NR_readv ] = (syscall_handler_t *) sys_readv, - [ __NR_writev ] = (syscall_handler_t *) sys_writev, - [ __NR_getsid ] = (syscall_handler_t *) sys_getsid, - [ __NR_fdatasync ] = (syscall_handler_t *) sys_fdatasync, - [ __NR__sysctl ] = (syscall_handler_t *) sys_sysctl, - [ __NR_mlock ] = (syscall_handler_t *) sys_mlock, - [ __NR_munlock ] = (syscall_handler_t *) sys_munlock, - [ __NR_mlockall ] = (syscall_handler_t *) sys_mlockall, - [ __NR_munlockall ] = (syscall_handler_t *) sys_munlockall, - [ __NR_sched_setparam ] = (syscall_handler_t *) sys_sched_setparam, - [ __NR_sched_getparam ] = (syscall_handler_t *) sys_sched_getparam, - [ __NR_sched_setscheduler ] = (syscall_handler_t *) sys_sched_setscheduler, - [ __NR_sched_getscheduler ] = (syscall_handler_t *) sys_sched_getscheduler, - [ __NR_sched_yield ] = (syscall_handler_t *) yield, - [ __NR_sched_get_priority_max ] = (syscall_handler_t *) sys_sched_get_priority_max, - [ __NR_sched_get_priority_min ] = (syscall_handler_t *) sys_sched_get_priority_min, - [ __NR_sched_rr_get_interval ] = (syscall_handler_t *) sys_sched_rr_get_interval, - [ __NR_nanosleep ] = (syscall_handler_t *) sys_nanosleep, - [ __NR_mremap ] = (syscall_handler_t *) sys_mremap, - [ __NR_setresuid ] = (syscall_handler_t *) sys_setresuid16, - [ __NR_getresuid ] = (syscall_handler_t *) sys_getresuid16, - [ __NR_query_module ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_poll ] = (syscall_handler_t *) sys_poll, - [ __NR_nfsservctl ] = (syscall_handler_t *) sys_nfsservctl, - [ __NR_setresgid ] = (syscall_handler_t *) sys_setresgid16, - [ __NR_getresgid ] = (syscall_handler_t *) sys_getresgid16, - [ __NR_prctl ] = (syscall_handler_t *) sys_prctl, - [ __NR_rt_sigreturn ] = (syscall_handler_t *) sys_rt_sigreturn, - [ __NR_rt_sigaction ] = (syscall_handler_t *) sys_rt_sigaction, - [ __NR_rt_sigprocmask ] = (syscall_handler_t *) sys_rt_sigprocmask, - [ __NR_rt_sigpending ] = (syscall_handler_t *) sys_rt_sigpending, - [ __NR_rt_sigtimedwait ] = (syscall_handler_t *) sys_rt_sigtimedwait, - [ __NR_rt_sigqueueinfo ] = (syscall_handler_t *) sys_rt_sigqueueinfo, - [ __NR_rt_sigsuspend ] = (syscall_handler_t *) sys_rt_sigsuspend, - [ __NR_pread64 ] = (syscall_handler_t *) sys_pread64, - [ __NR_pwrite64 ] = (syscall_handler_t *) sys_pwrite64, - [ __NR_chown ] = (syscall_handler_t *) sys_chown16, - [ __NR_getcwd ] = (syscall_handler_t *) sys_getcwd, - [ __NR_capget ] = (syscall_handler_t *) sys_capget, - [ __NR_capset ] = (syscall_handler_t *) sys_capset, - [ __NR_sigaltstack ] = (syscall_handler_t *) sys_sigaltstack, - [ __NR_sendfile ] = (syscall_handler_t *) sys_sendfile, - [ __NR_getpmsg ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_putpmsg ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_vfork ] = (syscall_handler_t *) sys_vfork, - [ __NR_getdents64 ] = (syscall_handler_t *) sys_getdents64, - [ __NR_gettid ] = (syscall_handler_t *) sys_gettid, - [ __NR_readahead ] = (syscall_handler_t *) sys_readahead, - [ __NR_setxattr ] = (syscall_handler_t *) sys_setxattr, - [ __NR_lsetxattr ] = (syscall_handler_t *) sys_lsetxattr, - [ __NR_fsetxattr ] = (syscall_handler_t *) sys_fsetxattr, - [ __NR_getxattr ] = (syscall_handler_t *) sys_getxattr, - [ __NR_lgetxattr ] = (syscall_handler_t *) sys_lgetxattr, - [ __NR_fgetxattr ] = (syscall_handler_t *) sys_fgetxattr, - [ __NR_listxattr ] = (syscall_handler_t *) sys_listxattr, - [ __NR_llistxattr ] = (syscall_handler_t *) sys_llistxattr, - [ __NR_flistxattr ] = (syscall_handler_t *) sys_flistxattr, - [ __NR_removexattr ] = (syscall_handler_t *) sys_removexattr, - [ __NR_lremovexattr ] = (syscall_handler_t *) sys_lremovexattr, - [ __NR_fremovexattr ] = (syscall_handler_t *) sys_fremovexattr, - [ __NR_tkill ] = (syscall_handler_t *) sys_tkill, - [ __NR_futex ] = (syscall_handler_t *) sys_futex, - [ __NR_sched_setaffinity ] = (syscall_handler_t *) sys_sched_setaffinity, - [ __NR_sched_getaffinity ] = (syscall_handler_t *) sys_sched_getaffinity, - [ __NR_io_setup ] = (syscall_handler_t *) sys_io_setup, - [ __NR_io_destroy ] = (syscall_handler_t *) sys_io_destroy, - [ __NR_io_getevents ] = (syscall_handler_t *) sys_io_getevents, - [ __NR_io_submit ] = (syscall_handler_t *) sys_io_submit, - [ __NR_io_cancel ] = (syscall_handler_t *) sys_io_cancel, - [ __NR_exit_group ] = (syscall_handler_t *) sys_exit_group, - [ __NR_lookup_dcookie ] = (syscall_handler_t *) sys_lookup_dcookie, - [ __NR_epoll_create ] = (syscall_handler_t *) sys_epoll_create, - [ __NR_epoll_ctl ] = (syscall_handler_t *) sys_epoll_ctl, - [ __NR_epoll_wait ] = (syscall_handler_t *) sys_epoll_wait, - [ __NR_remap_file_pages ] = (syscall_handler_t *) sys_remap_file_pages, - [ __NR_set_tid_address ] = (syscall_handler_t *) sys_set_tid_address, - [ __NR_timer_create ] = (syscall_handler_t *) sys_timer_create, - [ __NR_timer_settime ] = (syscall_handler_t *) sys_timer_settime, - [ __NR_timer_gettime ] = (syscall_handler_t *) sys_timer_gettime, - [ __NR_timer_getoverrun ] = (syscall_handler_t *) sys_timer_getoverrun, - [ __NR_timer_delete ] = (syscall_handler_t *) sys_timer_delete, - [ __NR_clock_settime ] = (syscall_handler_t *) sys_clock_settime, - [ __NR_clock_gettime ] = (syscall_handler_t *) sys_clock_gettime, - [ __NR_clock_getres ] = (syscall_handler_t *) sys_clock_getres, - [ __NR_clock_nanosleep ] = (syscall_handler_t *) sys_clock_nanosleep, - [ __NR_tgkill ] = (syscall_handler_t *) sys_tgkill, - [ __NR_utimes ] = (syscall_handler_t *) sys_utimes, - [ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64, - [ __NR_vserver ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_mbind ] = (syscall_handler_t *) sys_mbind, - [ __NR_get_mempolicy ] = (syscall_handler_t *) sys_get_mempolicy, - [ __NR_set_mempolicy ] = (syscall_handler_t *) sys_set_mempolicy, - [ __NR_mq_open ] = (syscall_handler_t *) sys_mq_open, - [ __NR_mq_unlink ] = (syscall_handler_t *) sys_mq_unlink, - [ __NR_mq_timedsend ] = (syscall_handler_t *) sys_mq_timedsend, - [ __NR_mq_timedreceive ] = (syscall_handler_t *) sys_mq_timedreceive, - [ __NR_mq_notify ] = (syscall_handler_t *) sys_mq_notify, - [ __NR_mq_getsetattr ] = (syscall_handler_t *) sys_mq_getsetattr, - [ __NR_kexec_load ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_waitid ] = (syscall_handler_t *) sys_waitid, - [ __NR_add_key ] = (syscall_handler_t *) sys_add_key, - [ __NR_request_key ] = (syscall_handler_t *) sys_request_key, - [ __NR_keyctl ] = (syscall_handler_t *) sys_keyctl, - - ARCH_SYSCALLS - [ LAST_SYSCALL + 1 ... NR_syscalls ] = - (syscall_handler_t *) sys_ni_syscall -}; diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile index 71b47e618605..950781e354de 100644 --- a/arch/um/sys-i386/Makefile +++ b/arch/um/sys-i386/Makefile @@ -1,5 +1,6 @@ obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ - ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o + ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o \ + sys_call_table.o obj-$(CONFIG_HIGHMEM) += highmem.o obj-$(CONFIG_MODULES) += module.o diff --git a/arch/um/sys-i386/sys_call_table.S b/arch/um/sys-i386/sys_call_table.S new file mode 100644 index 000000000000..ad75c27afe38 --- /dev/null +++ b/arch/um/sys-i386/sys_call_table.S @@ -0,0 +1,16 @@ +#include +/* Steal i386 syscall table for our purposes, but with some slight changes.*/ + +#define sys_iopl sys_ni_syscall +#define sys_ioperm sys_ni_syscall + +#define sys_vm86old sys_ni_syscall +#define sys_vm86 sys_ni_syscall +#define sys_set_thread_area sys_ni_syscall +#define sys_get_thread_area sys_ni_syscall + +#define sys_stime um_stime +#define sys_time um_time +#define old_mmap old_mmap_i386 + +#include "../../i386/kernel/syscall_table.S" diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile index 2129e3143559..274158e7da3f 100644 --- a/arch/um/sys-x86_64/Makefile +++ b/arch/um/sys-x86_64/Makefile @@ -6,7 +6,7 @@ lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \ - syscalls.o sysrq.o thunk.o + syscalls.o sysrq.o thunk.o sys_call_table.o USER_OBJS := ptrace_user.o sigcontext.o diff --git a/arch/um/sys-x86_64/sys_call_table.c b/arch/um/sys-x86_64/sys_call_table.c new file mode 100644 index 000000000000..3f5efbfb46de --- /dev/null +++ b/arch/um/sys-x86_64/sys_call_table.c @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) + * Copyright 2003 PathScale, Inc. + * Licensed under the GPL + */ + +#include "linux/config.h" +#include "linux/unistd.h" +#include "linux/sys.h" +#include "linux/swap.h" +#include "linux/syscalls.h" +#include "linux/sysctl.h" +#include "asm/signal.h" +#include "sysdep/syscalls.h" +#include "kern_util.h" + +#ifdef CONFIG_NFSD +#define NFSSERVCTL sys_nfsservctl +#else +#define NFSSERVCTL sys_ni_syscall +#endif + +#define LAST_GENERIC_SYSCALL __NR_keyctl + +#if LAST_GENERIC_SYSCALL > LAST_ARCH_SYSCALL +#define LAST_SYSCALL LAST_GENERIC_SYSCALL +#else +#define LAST_SYSCALL LAST_ARCH_SYSCALL +#endif + +extern syscall_handler_t sys_fork; +extern syscall_handler_t sys_execve; +extern syscall_handler_t um_time; +extern syscall_handler_t um_stime; +extern syscall_handler_t sys_pipe; +extern syscall_handler_t sys_olduname; +extern syscall_handler_t sys_sigaction; +extern syscall_handler_t sys_sigsuspend; +extern syscall_handler_t old_readdir; +extern syscall_handler_t sys_uname; +extern syscall_handler_t sys_ipc; +extern syscall_handler_t sys_sigreturn; +extern syscall_handler_t sys_clone; +extern syscall_handler_t sys_rt_sigreturn; +extern syscall_handler_t sys_sigaltstack; +extern syscall_handler_t sys_vfork; +extern syscall_handler_t old_select; +extern syscall_handler_t sys_modify_ldt; +extern syscall_handler_t sys_rt_sigsuspend; +extern syscall_handler_t sys_mbind; +extern syscall_handler_t sys_get_mempolicy; +extern syscall_handler_t sys_set_mempolicy; +extern syscall_handler_t sys_sys_setaltroot; + +syscall_handler_t *sys_call_table[] = { + [ __NR_restart_syscall ] = (syscall_handler_t *) sys_restart_syscall, + [ __NR_exit ] = (syscall_handler_t *) sys_exit, + [ __NR_fork ] = (syscall_handler_t *) sys_fork, + [ __NR_read ] = (syscall_handler_t *) sys_read, + [ __NR_write ] = (syscall_handler_t *) sys_write, + + /* These three are declared differently in asm/unistd.h */ + [ __NR_open ] = (syscall_handler_t *) sys_open, + [ __NR_close ] = (syscall_handler_t *) sys_close, + [ __NR_creat ] = (syscall_handler_t *) sys_creat, + [ __NR_link ] = (syscall_handler_t *) sys_link, + [ __NR_unlink ] = (syscall_handler_t *) sys_unlink, + [ __NR_execve ] = (syscall_handler_t *) sys_execve, + + /* declared differently in kern_util.h */ + [ __NR_chdir ] = (syscall_handler_t *) sys_chdir, + [ __NR_time ] = um_time, + [ __NR_mknod ] = (syscall_handler_t *) sys_mknod, + [ __NR_chmod ] = (syscall_handler_t *) sys_chmod, + [ __NR_lchown ] = (syscall_handler_t *) sys_lchown16, + [ __NR_lseek ] = (syscall_handler_t *) sys_lseek, + [ __NR_getpid ] = (syscall_handler_t *) sys_getpid, + [ __NR_mount ] = (syscall_handler_t *) sys_mount, + [ __NR_setuid ] = (syscall_handler_t *) sys_setuid16, + [ __NR_getuid ] = (syscall_handler_t *) sys_getuid16, + [ __NR_ptrace ] = (syscall_handler_t *) sys_ptrace, + [ __NR_alarm ] = (syscall_handler_t *) sys_alarm, + [ __NR_pause ] = (syscall_handler_t *) sys_pause, + [ __NR_utime ] = (syscall_handler_t *) sys_utime, + [ __NR_access ] = (syscall_handler_t *) sys_access, + [ __NR_sync ] = (syscall_handler_t *) sys_sync, + [ __NR_kill ] = (syscall_handler_t *) sys_kill, + [ __NR_rename ] = (syscall_handler_t *) sys_rename, + [ __NR_mkdir ] = (syscall_handler_t *) sys_mkdir, + [ __NR_rmdir ] = (syscall_handler_t *) sys_rmdir, + + /* Declared differently in asm/unistd.h */ + [ __NR_dup ] = (syscall_handler_t *) sys_dup, + [ __NR_pipe ] = (syscall_handler_t *) sys_pipe, + [ __NR_times ] = (syscall_handler_t *) sys_times, + [ __NR_brk ] = (syscall_handler_t *) sys_brk, + [ __NR_setgid ] = (syscall_handler_t *) sys_setgid16, + [ __NR_getgid ] = (syscall_handler_t *) sys_getgid16, + [ __NR_geteuid ] = (syscall_handler_t *) sys_geteuid16, + [ __NR_getegid ] = (syscall_handler_t *) sys_getegid16, + [ __NR_acct ] = (syscall_handler_t *) sys_acct, + [ __NR_umount2 ] = (syscall_handler_t *) sys_umount, + [ __NR_ioctl ] = (syscall_handler_t *) sys_ioctl, + [ __NR_fcntl ] = (syscall_handler_t *) sys_fcntl, + [ __NR_setpgid ] = (syscall_handler_t *) sys_setpgid, + [ __NR_umask ] = (syscall_handler_t *) sys_umask, + [ __NR_chroot ] = (syscall_handler_t *) sys_chroot, + [ __NR_ustat ] = (syscall_handler_t *) sys_ustat, + [ __NR_dup2 ] = (syscall_handler_t *) sys_dup2, + [ __NR_getppid ] = (syscall_handler_t *) sys_getppid, + [ __NR_getpgrp ] = (syscall_handler_t *) sys_getpgrp, + [ __NR_setsid ] = (syscall_handler_t *) sys_setsid, + [ __NR_setreuid ] = (syscall_handler_t *) sys_setreuid16, + [ __NR_setregid ] = (syscall_handler_t *) sys_setregid16, + [ __NR_sethostname ] = (syscall_handler_t *) sys_sethostname, + [ __NR_setrlimit ] = (syscall_handler_t *) sys_setrlimit, + [ __NR_getrlimit ] = (syscall_handler_t *) sys_old_getrlimit, + [ __NR_getrusage ] = (syscall_handler_t *) sys_getrusage, + [ __NR_gettimeofday ] = (syscall_handler_t *) sys_gettimeofday, + [ __NR_settimeofday ] = (syscall_handler_t *) sys_settimeofday, + [ __NR_getgroups ] = (syscall_handler_t *) sys_getgroups16, + [ __NR_setgroups ] = (syscall_handler_t *) sys_setgroups16, + [ __NR_symlink ] = (syscall_handler_t *) sys_symlink, + [ __NR_readlink ] = (syscall_handler_t *) sys_readlink, + [ __NR_uselib ] = (syscall_handler_t *) sys_uselib, + [ __NR_swapon ] = (syscall_handler_t *) sys_swapon, + [ __NR_reboot ] = (syscall_handler_t *) sys_reboot, + [ __NR_munmap ] = (syscall_handler_t *) sys_munmap, + [ __NR_truncate ] = (syscall_handler_t *) sys_truncate, + [ __NR_ftruncate ] = (syscall_handler_t *) sys_ftruncate, + [ __NR_fchmod ] = (syscall_handler_t *) sys_fchmod, + [ __NR_fchown ] = (syscall_handler_t *) sys_fchown16, + [ __NR_getpriority ] = (syscall_handler_t *) sys_getpriority, + [ __NR_setpriority ] = (syscall_handler_t *) sys_setpriority, + [ __NR_statfs ] = (syscall_handler_t *) sys_statfs, + [ __NR_fstatfs ] = (syscall_handler_t *) sys_fstatfs, + [ __NR_ioperm ] = (syscall_handler_t *) sys_ni_syscall, + [ __NR_syslog ] = (syscall_handler_t *) sys_syslog, + [ __NR_setitimer ] = (syscall_handler_t *) sys_setitimer, + [ __NR_getitimer ] = (syscall_handler_t *) sys_getitimer, + [ __NR_stat ] = (syscall_handler_t *) sys_newstat, + [ __NR_lstat ] = (syscall_handler_t *) sys_newlstat, + [ __NR_fstat ] = (syscall_handler_t *) sys_newfstat, + [ __NR_vhangup ] = (syscall_handler_t *) sys_vhangup, + [ __NR_wait4 ] = (syscall_handler_t *) sys_wait4, + [ __NR_swapoff ] = (syscall_handler_t *) sys_swapoff, + [ __NR_sysinfo ] = (syscall_handler_t *) sys_sysinfo, + [ __NR_fsync ] = (syscall_handler_t *) sys_fsync, + [ __NR_clone ] = (syscall_handler_t *) sys_clone, + [ __NR_setdomainname ] = (syscall_handler_t *) sys_setdomainname, + [ __NR_uname ] = (syscall_handler_t *) sys_newuname, + [ __NR_adjtimex ] = (syscall_handler_t *) sys_adjtimex, + [ __NR_mprotect ] = (syscall_handler_t *) sys_mprotect, + [ __NR_create_module ] = (syscall_handler_t *) sys_ni_syscall, + [ __NR_init_module ] = (syscall_handler_t *) sys_init_module, + [ __NR_delete_module ] = (syscall_handler_t *) sys_delete_module, + [ __NR_get_kernel_syms ] = (syscall_handler_t *) sys_ni_syscall, + [ __NR_quotactl ] = (syscall_handler_t *) sys_quotactl, + [ __NR_getpgid ] = (syscall_handler_t *) sys_getpgid, + [ __NR_fchdir ] = (syscall_handler_t *) sys_fchdir, + [ __NR_sysfs ] = (syscall_handler_t *) sys_sysfs, + [ __NR_personality ] = (syscall_handler_t *) sys_personality, + [ __NR_afs_syscall ] = (syscall_handler_t *) sys_ni_syscall, + [ __NR_setfsuid ] = (syscall_handler_t *) sys_setfsuid16, + [ __NR_setfsgid ] = (syscall_handler_t *) sys_setfsgid16, + [ __NR_getdents ] = (syscall_handler_t *) sys_getdents, + [ __NR_flock ] = (syscall_handler_t *) sys_flock, + [ __NR_msync ] = (syscall_handler_t *) sys_msync, + [ __NR_readv ] = (syscall_handler_t *) sys_readv, + [ __NR_writev ] = (syscall_handler_t *) sys_writev, + [ __NR_getsid ] = (syscall_handler_t *) sys_getsid, + [ __NR_fdatasync ] = (syscall_handler_t *) sys_fdatasync, + [ __NR__sysctl ] = (syscall_handler_t *) sys_sysctl, + [ __NR_mlock ] = (syscall_handler_t *) sys_mlock, + [ __NR_munlock ] = (syscall_handler_t *) sys_munlock, + [ __NR_mlockall ] = (syscall_handler_t *) sys_mlockall, + [ __NR_munlockall ] = (syscall_handler_t *) sys_munlockall, + [ __NR_sched_setparam ] = (syscall_handler_t *) sys_sched_setparam, + [ __NR_sched_getparam ] = (syscall_handler_t *) sys_sched_getparam, + [ __NR_sched_setscheduler ] = (syscall_handler_t *) sys_sched_setscheduler, + [ __NR_sched_getscheduler ] = (syscall_handler_t *) sys_sched_getscheduler, + [ __NR_sched_yield ] = (syscall_handler_t *) yield, + [ __NR_sched_get_priority_max ] = (syscall_handler_t *) sys_sched_get_priority_max, + [ __NR_sched_get_priority_min ] = (syscall_handler_t *) sys_sched_get_priority_min, + [ __NR_sched_rr_get_interval ] = (syscall_handler_t *) sys_sched_rr_get_interval, + [ __NR_nanosleep ] = (syscall_handler_t *) sys_nanosleep, + [ __NR_mremap ] = (syscall_handler_t *) sys_mremap, + [ __NR_setresuid ] = (syscall_handler_t *) sys_setresuid16, + [ __NR_getresuid ] = (syscall_handler_t *) sys_getresuid16, + [ __NR_query_module ] = (syscall_handler_t *) sys_ni_syscall, + [ __NR_poll ] = (syscall_handler_t *) sys_poll, + [ __NR_nfsservctl ] = (syscall_handler_t *) NFSSERVCTL, + [ __NR_setresgid ] = (syscall_handler_t *) sys_setresgid16, + [ __NR_getresgid ] = (syscall_handler_t *) sys_getresgid16, + [ __NR_prctl ] = (syscall_handler_t *) sys_prctl, + [ __NR_rt_sigreturn ] = (syscall_handler_t *) sys_rt_sigreturn, + [ __NR_rt_sigaction ] = (syscall_handler_t *) sys_rt_sigaction, + [ __NR_rt_sigprocmask ] = (syscall_handler_t *) sys_rt_sigprocmask, + [ __NR_rt_sigpending ] = (syscall_handler_t *) sys_rt_sigpending, + [ __NR_rt_sigtimedwait ] = (syscall_handler_t *) sys_rt_sigtimedwait, + [ __NR_rt_sigqueueinfo ] = (syscall_handler_t *) sys_rt_sigqueueinfo, + [ __NR_rt_sigsuspend ] = (syscall_handler_t *) sys_rt_sigsuspend, + [ __NR_pread64 ] = (syscall_handler_t *) sys_pread64, + [ __NR_pwrite64 ] = (syscall_handler_t *) sys_pwrite64, + [ __NR_chown ] = (syscall_handler_t *) sys_chown16, + [ __NR_getcwd ] = (syscall_handler_t *) sys_getcwd, + [ __NR_capget ] = (syscall_handler_t *) sys_capget, + [ __NR_capset ] = (syscall_handler_t *) sys_capset, + [ __NR_sigaltstack ] = (syscall_handler_t *) sys_sigaltstack, + [ __NR_sendfile ] = (syscall_handler_t *) sys_sendfile, + [ __NR_getpmsg ] = (syscall_handler_t *) sys_ni_syscall, + [ __NR_putpmsg ] = (syscall_handler_t *) sys_ni_syscall, + [ __NR_vfork ] = (syscall_handler_t *) sys_vfork, + [ __NR_getdents64 ] = (syscall_handler_t *) sys_getdents64, + [ __NR_gettid ] = (syscall_handler_t *) sys_gettid, + [ __NR_readahead ] = (syscall_handler_t *) sys_readahead, + [ __NR_setxattr ] = (syscall_handler_t *) sys_setxattr, + [ __NR_lsetxattr ] = (syscall_handler_t *) sys_lsetxattr, + [ __NR_fsetxattr ] = (syscall_handler_t *) sys_fsetxattr, + [ __NR_getxattr ] = (syscall_handler_t *) sys_getxattr, + [ __NR_lgetxattr ] = (syscall_handler_t *) sys_lgetxattr, + [ __NR_fgetxattr ] = (syscall_handler_t *) sys_fgetxattr, + [ __NR_listxattr ] = (syscall_handler_t *) sys_listxattr, + [ __NR_llistxattr ] = (syscall_handler_t *) sys_llistxattr, + [ __NR_flistxattr ] = (syscall_handler_t *) sys_flistxattr, + [ __NR_removexattr ] = (syscall_handler_t *) sys_removexattr, + [ __NR_lremovexattr ] = (syscall_handler_t *) sys_lremovexattr, + [ __NR_fremovexattr ] = (syscall_handler_t *) sys_fremovexattr, + [ __NR_tkill ] = (syscall_handler_t *) sys_tkill, + [ __NR_futex ] = (syscall_handler_t *) sys_futex, + [ __NR_sched_setaffinity ] = (syscall_handler_t *) sys_sched_setaffinity, + [ __NR_sched_getaffinity ] = (syscall_handler_t *) sys_sched_getaffinity, + [ __NR_io_setup ] = (syscall_handler_t *) sys_io_setup, + [ __NR_io_destroy ] = (syscall_handler_t *) sys_io_destroy, + [ __NR_io_getevents ] = (syscall_handler_t *) sys_io_getevents, + [ __NR_io_submit ] = (syscall_handler_t *) sys_io_submit, + [ __NR_io_cancel ] = (syscall_handler_t *) sys_io_cancel, + [ __NR_exit_group ] = (syscall_handler_t *) sys_exit_group, + [ __NR_lookup_dcookie ] = (syscall_handler_t *) sys_lookup_dcookie, + [ __NR_epoll_create ] = (syscall_handler_t *) sys_epoll_create, + [ __NR_epoll_ctl ] = (syscall_handler_t *) sys_epoll_ctl, + [ __NR_epoll_wait ] = (syscall_handler_t *) sys_epoll_wait, + [ __NR_remap_file_pages ] = (syscall_handler_t *) sys_remap_file_pages, + [ __NR_set_tid_address ] = (syscall_handler_t *) sys_set_tid_address, + [ __NR_timer_create ] = (syscall_handler_t *) sys_timer_create, + [ __NR_timer_settime ] = (syscall_handler_t *) sys_timer_settime, + [ __NR_timer_gettime ] = (syscall_handler_t *) sys_timer_gettime, + [ __NR_timer_getoverrun ] = (syscall_handler_t *) sys_timer_getoverrun, + [ __NR_timer_delete ] = (syscall_handler_t *) sys_timer_delete, + [ __NR_clock_settime ] = (syscall_handler_t *) sys_clock_settime, + [ __NR_clock_gettime ] = (syscall_handler_t *) sys_clock_gettime, + [ __NR_clock_getres ] = (syscall_handler_t *) sys_clock_getres, + [ __NR_clock_nanosleep ] = (syscall_handler_t *) sys_clock_nanosleep, + [ __NR_tgkill ] = (syscall_handler_t *) sys_tgkill, + [ __NR_utimes ] = (syscall_handler_t *) sys_utimes, + [ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64, + [ __NR_vserver ] = (syscall_handler_t *) sys_ni_syscall, + [ __NR_mbind ] = (syscall_handler_t *) sys_mbind, + [ __NR_get_mempolicy ] = (syscall_handler_t *) sys_get_mempolicy, + [ __NR_set_mempolicy ] = (syscall_handler_t *) sys_set_mempolicy, + [ __NR_mq_open ] = (syscall_handler_t *) sys_mq_open, + [ __NR_mq_unlink ] = (syscall_handler_t *) sys_mq_unlink, + [ __NR_mq_timedsend ] = (syscall_handler_t *) sys_mq_timedsend, + [ __NR_mq_timedreceive ] = (syscall_handler_t *) sys_mq_timedreceive, + [ __NR_mq_notify ] = (syscall_handler_t *) sys_mq_notify, + [ __NR_mq_getsetattr ] = (syscall_handler_t *) sys_mq_getsetattr, + [ __NR_kexec_load ] = (syscall_handler_t *) sys_ni_syscall, + [ __NR_waitid ] = (syscall_handler_t *) sys_waitid, + [ __NR_add_key ] = (syscall_handler_t *) sys_add_key, + [ __NR_request_key ] = (syscall_handler_t *) sys_request_key, + [ __NR_keyctl ] = (syscall_handler_t *) sys_keyctl, + + ARCH_SYSCALLS + [ LAST_SYSCALL + 1 ... NR_syscalls ] = + (syscall_handler_t *) sys_ni_syscall +}; -- cgit v1.2.3-59-g8ed1b From ddcd6b175793839e51fdd55debb670a9f512c448 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 1 May 2005 08:58:55 -0700 Subject: [PATCH] uml: quick fix syscall table for x86_64 Fix the moved syscall table for the x86_64 SUBARCH: - redirect __NR_chown and such to versions aware of 32-bit UIDs, - avoid the useless hack for sys_nfsservctl, - use sys_sendfile64 in the table rather than sys_sendfile. - __NR_uselib is sys_ni_syscall on x86_64 (which does not support A.OUT). - __NR_getrlimit is sys_getrlimit, not sys_old_getrlimit Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/sys-x86_64/sys_call_table.c | 53 +++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 29 deletions(-) (limited to 'arch/um') diff --git a/arch/um/sys-x86_64/sys_call_table.c b/arch/um/sys-x86_64/sys_call_table.c index 3f5efbfb46de..a31e0dffb270 100644 --- a/arch/um/sys-x86_64/sys_call_table.c +++ b/arch/um/sys-x86_64/sys_call_table.c @@ -14,12 +14,6 @@ #include "sysdep/syscalls.h" #include "kern_util.h" -#ifdef CONFIG_NFSD -#define NFSSERVCTL sys_nfsservctl -#else -#define NFSSERVCTL sys_ni_syscall -#endif - #define LAST_GENERIC_SYSCALL __NR_keyctl #if LAST_GENERIC_SYSCALL > LAST_ARCH_SYSCALL @@ -52,6 +46,7 @@ extern syscall_handler_t sys_get_mempolicy; extern syscall_handler_t sys_set_mempolicy; extern syscall_handler_t sys_sys_setaltroot; +/* On X86-64 all syscalls are aware of 32-bit [ug]ids, so I had to fix this!*/ syscall_handler_t *sys_call_table[] = { [ __NR_restart_syscall ] = (syscall_handler_t *) sys_restart_syscall, [ __NR_exit ] = (syscall_handler_t *) sys_exit, @@ -72,12 +67,12 @@ syscall_handler_t *sys_call_table[] = { [ __NR_time ] = um_time, [ __NR_mknod ] = (syscall_handler_t *) sys_mknod, [ __NR_chmod ] = (syscall_handler_t *) sys_chmod, - [ __NR_lchown ] = (syscall_handler_t *) sys_lchown16, + [ __NR_lchown ] = (syscall_handler_t *) sys_lchown, [ __NR_lseek ] = (syscall_handler_t *) sys_lseek, [ __NR_getpid ] = (syscall_handler_t *) sys_getpid, [ __NR_mount ] = (syscall_handler_t *) sys_mount, - [ __NR_setuid ] = (syscall_handler_t *) sys_setuid16, - [ __NR_getuid ] = (syscall_handler_t *) sys_getuid16, + [ __NR_setuid ] = (syscall_handler_t *) sys_setuid, + [ __NR_getuid ] = (syscall_handler_t *) sys_getuid, [ __NR_ptrace ] = (syscall_handler_t *) sys_ptrace, [ __NR_alarm ] = (syscall_handler_t *) sys_alarm, [ __NR_pause ] = (syscall_handler_t *) sys_pause, @@ -94,10 +89,10 @@ syscall_handler_t *sys_call_table[] = { [ __NR_pipe ] = (syscall_handler_t *) sys_pipe, [ __NR_times ] = (syscall_handler_t *) sys_times, [ __NR_brk ] = (syscall_handler_t *) sys_brk, - [ __NR_setgid ] = (syscall_handler_t *) sys_setgid16, - [ __NR_getgid ] = (syscall_handler_t *) sys_getgid16, - [ __NR_geteuid ] = (syscall_handler_t *) sys_geteuid16, - [ __NR_getegid ] = (syscall_handler_t *) sys_getegid16, + [ __NR_setgid ] = (syscall_handler_t *) sys_setgid, + [ __NR_getgid ] = (syscall_handler_t *) sys_getgid, + [ __NR_geteuid ] = (syscall_handler_t *) sys_geteuid, + [ __NR_getegid ] = (syscall_handler_t *) sys_getegid, [ __NR_acct ] = (syscall_handler_t *) sys_acct, [ __NR_umount2 ] = (syscall_handler_t *) sys_umount, [ __NR_ioctl ] = (syscall_handler_t *) sys_ioctl, @@ -110,26 +105,26 @@ syscall_handler_t *sys_call_table[] = { [ __NR_getppid ] = (syscall_handler_t *) sys_getppid, [ __NR_getpgrp ] = (syscall_handler_t *) sys_getpgrp, [ __NR_setsid ] = (syscall_handler_t *) sys_setsid, - [ __NR_setreuid ] = (syscall_handler_t *) sys_setreuid16, - [ __NR_setregid ] = (syscall_handler_t *) sys_setregid16, + [ __NR_setreuid ] = (syscall_handler_t *) sys_setreuid, + [ __NR_setregid ] = (syscall_handler_t *) sys_setregid, [ __NR_sethostname ] = (syscall_handler_t *) sys_sethostname, [ __NR_setrlimit ] = (syscall_handler_t *) sys_setrlimit, - [ __NR_getrlimit ] = (syscall_handler_t *) sys_old_getrlimit, + [ __NR_getrlimit ] = (syscall_handler_t *) sys_getrlimit, [ __NR_getrusage ] = (syscall_handler_t *) sys_getrusage, [ __NR_gettimeofday ] = (syscall_handler_t *) sys_gettimeofday, [ __NR_settimeofday ] = (syscall_handler_t *) sys_settimeofday, - [ __NR_getgroups ] = (syscall_handler_t *) sys_getgroups16, - [ __NR_setgroups ] = (syscall_handler_t *) sys_setgroups16, + [ __NR_getgroups ] = (syscall_handler_t *) sys_getgroups, + [ __NR_setgroups ] = (syscall_handler_t *) sys_setgroups, [ __NR_symlink ] = (syscall_handler_t *) sys_symlink, [ __NR_readlink ] = (syscall_handler_t *) sys_readlink, - [ __NR_uselib ] = (syscall_handler_t *) sys_uselib, + [ __NR_uselib ] = (syscall_handler_t *) sys_ni_syscall, [ __NR_swapon ] = (syscall_handler_t *) sys_swapon, [ __NR_reboot ] = (syscall_handler_t *) sys_reboot, [ __NR_munmap ] = (syscall_handler_t *) sys_munmap, [ __NR_truncate ] = (syscall_handler_t *) sys_truncate, [ __NR_ftruncate ] = (syscall_handler_t *) sys_ftruncate, [ __NR_fchmod ] = (syscall_handler_t *) sys_fchmod, - [ __NR_fchown ] = (syscall_handler_t *) sys_fchown16, + [ __NR_fchown ] = (syscall_handler_t *) sys_fchown, [ __NR_getpriority ] = (syscall_handler_t *) sys_getpriority, [ __NR_setpriority ] = (syscall_handler_t *) sys_setpriority, [ __NR_statfs ] = (syscall_handler_t *) sys_statfs, @@ -161,8 +156,8 @@ syscall_handler_t *sys_call_table[] = { [ __NR_sysfs ] = (syscall_handler_t *) sys_sysfs, [ __NR_personality ] = (syscall_handler_t *) sys_personality, [ __NR_afs_syscall ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_setfsuid ] = (syscall_handler_t *) sys_setfsuid16, - [ __NR_setfsgid ] = (syscall_handler_t *) sys_setfsgid16, + [ __NR_setfsuid ] = (syscall_handler_t *) sys_setfsuid, + [ __NR_setfsgid ] = (syscall_handler_t *) sys_setfsgid, [ __NR_getdents ] = (syscall_handler_t *) sys_getdents, [ __NR_flock ] = (syscall_handler_t *) sys_flock, [ __NR_msync ] = (syscall_handler_t *) sys_msync, @@ -185,13 +180,13 @@ syscall_handler_t *sys_call_table[] = { [ __NR_sched_rr_get_interval ] = (syscall_handler_t *) sys_sched_rr_get_interval, [ __NR_nanosleep ] = (syscall_handler_t *) sys_nanosleep, [ __NR_mremap ] = (syscall_handler_t *) sys_mremap, - [ __NR_setresuid ] = (syscall_handler_t *) sys_setresuid16, - [ __NR_getresuid ] = (syscall_handler_t *) sys_getresuid16, + [ __NR_setresuid ] = (syscall_handler_t *) sys_setresuid, + [ __NR_getresuid ] = (syscall_handler_t *) sys_getresuid, [ __NR_query_module ] = (syscall_handler_t *) sys_ni_syscall, [ __NR_poll ] = (syscall_handler_t *) sys_poll, - [ __NR_nfsservctl ] = (syscall_handler_t *) NFSSERVCTL, - [ __NR_setresgid ] = (syscall_handler_t *) sys_setresgid16, - [ __NR_getresgid ] = (syscall_handler_t *) sys_getresgid16, + [ __NR_nfsservctl ] = (syscall_handler_t *) sys_nfsservctl, + [ __NR_setresgid ] = (syscall_handler_t *) sys_setresgid, + [ __NR_getresgid ] = (syscall_handler_t *) sys_getresgid, [ __NR_prctl ] = (syscall_handler_t *) sys_prctl, [ __NR_rt_sigreturn ] = (syscall_handler_t *) sys_rt_sigreturn, [ __NR_rt_sigaction ] = (syscall_handler_t *) sys_rt_sigaction, @@ -202,12 +197,12 @@ syscall_handler_t *sys_call_table[] = { [ __NR_rt_sigsuspend ] = (syscall_handler_t *) sys_rt_sigsuspend, [ __NR_pread64 ] = (syscall_handler_t *) sys_pread64, [ __NR_pwrite64 ] = (syscall_handler_t *) sys_pwrite64, - [ __NR_chown ] = (syscall_handler_t *) sys_chown16, + [ __NR_chown ] = (syscall_handler_t *) sys_chown, [ __NR_getcwd ] = (syscall_handler_t *) sys_getcwd, [ __NR_capget ] = (syscall_handler_t *) sys_capget, [ __NR_capset ] = (syscall_handler_t *) sys_capset, [ __NR_sigaltstack ] = (syscall_handler_t *) sys_sigaltstack, - [ __NR_sendfile ] = (syscall_handler_t *) sys_sendfile, + [ __NR_sendfile ] = (syscall_handler_t *) sys_sendfile64, [ __NR_getpmsg ] = (syscall_handler_t *) sys_ni_syscall, [ __NR_putpmsg ] = (syscall_handler_t *) sys_ni_syscall, [ __NR_vfork ] = (syscall_handler_t *) sys_vfork, -- cgit v1.2.3-59-g8ed1b From 80f9507886076de0cadfdf2b87701e68156829c2 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 1 May 2005 08:58:55 -0700 Subject: [PATCH] uml: fix syscall table by including $(SUBARCH)'s one, for x86-64 Reuse asm-x86-64/unistd.h to build our syscall table, like x86-64 already does. Like for i386, we must add some #defines for all the (right!) changes UML does to x86-64 syscall table. Note: I noted a bogus: [ __NR_sched_yield ] = (syscall_handler_t *) yield, while doing this patch (which could only be a workaround for some strange bug, but I would ignore this possibility). I'm changing this without notice. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/include/sysdep-x86_64/syscalls.h | 47 +----- arch/um/sys-x86_64/Makefile | 2 +- arch/um/sys-x86_64/sys_call_table.c | 271 ------------------------------- arch/um/sys-x86_64/syscall_table.c | 59 +++++++ arch/um/sys-x86_64/syscalls.c | 12 ++ 5 files changed, 73 insertions(+), 318 deletions(-) delete mode 100644 arch/um/sys-x86_64/sys_call_table.c create mode 100644 arch/um/sys-x86_64/syscall_table.c (limited to 'arch/um') diff --git a/arch/um/include/sysdep-x86_64/syscalls.h b/arch/um/include/sysdep-x86_64/syscalls.h index 65a01e3d8707..b56b335c3514 100644 --- a/arch/um/include/sysdep-x86_64/syscalls.h +++ b/arch/um/include/sysdep-x86_64/syscalls.h @@ -30,51 +30,6 @@ extern syscall_handler_t wrap_sys_shmat; extern syscall_handler_t sys_modify_ldt; extern syscall_handler_t sys_arch_prctl; -#define ARCH_SYSCALLS \ - [ __NR_mmap ] = (syscall_handler_t *) old_mmap, \ - [ __NR_select ] = (syscall_handler_t *) sys_select, \ - [ __NR_mincore ] = (syscall_handler_t *) sys_mincore, \ - [ __NR_madvise ] = (syscall_handler_t *) sys_madvise, \ - [ __NR_shmget ] = (syscall_handler_t *) sys_shmget, \ - [ __NR_shmat ] = (syscall_handler_t *) wrap_sys_shmat, \ - [ __NR_shmctl ] = (syscall_handler_t *) sys_shmctl, \ - [ __NR_semop ] = (syscall_handler_t *) sys_semop, \ - [ __NR_semget ] = (syscall_handler_t *) sys_semget, \ - [ __NR_semctl ] = (syscall_handler_t *) sys_semctl, \ - [ __NR_shmdt ] = (syscall_handler_t *) sys_shmdt, \ - [ __NR_msgget ] = (syscall_handler_t *) sys_msgget, \ - [ __NR_msgsnd ] = (syscall_handler_t *) sys_msgsnd, \ - [ __NR_msgrcv ] = (syscall_handler_t *) sys_msgrcv, \ - [ __NR_msgctl ] = (syscall_handler_t *) sys_msgctl, \ - [ __NR_pivot_root ] = (syscall_handler_t *) sys_pivot_root, \ - [ __NR_tuxcall ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_security ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_epoll_ctl_old ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_epoll_wait_old ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_modify_ldt ] = (syscall_handler_t *) sys_modify_ldt, \ - [ __NR_arch_prctl ] = (syscall_handler_t *) sys_arch_prctl, \ - [ __NR_socket ] = (syscall_handler_t *) sys_socket, \ - [ __NR_connect ] = (syscall_handler_t *) sys_connect, \ - [ __NR_accept ] = (syscall_handler_t *) sys_accept, \ - [ __NR_recvfrom ] = (syscall_handler_t *) sys_recvfrom, \ - [ __NR_recvmsg ] = (syscall_handler_t *) sys_recvmsg, \ - [ __NR_sendmsg ] = (syscall_handler_t *) sys_sendmsg, \ - [ __NR_bind ] = (syscall_handler_t *) sys_bind, \ - [ __NR_listen ] = (syscall_handler_t *) sys_listen, \ - [ __NR_getsockname ] = (syscall_handler_t *) sys_getsockname, \ - [ __NR_getpeername ] = (syscall_handler_t *) sys_getpeername, \ - [ __NR_socketpair ] = (syscall_handler_t *) sys_socketpair, \ - [ __NR_sendto ] = (syscall_handler_t *) sys_sendto, \ - [ __NR_shutdown ] = (syscall_handler_t *) sys_shutdown, \ - [ __NR_setsockopt ] = (syscall_handler_t *) sys_setsockopt, \ - [ __NR_getsockopt ] = (syscall_handler_t *) sys_getsockopt, \ - [ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_set_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_get_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \ - [ __NR_semtimedop ] = (syscall_handler_t *) sys_semtimedop, \ - [ 251 ] = (syscall_handler_t *) sys_ni_syscall, - -#define LAST_ARCH_SYSCALL 251 -#define NR_syscalls 1024 +#define NR_syscalls (__NR_syscall_max + 1) #endif diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile index 274158e7da3f..d7ed2f7908df 100644 --- a/arch/um/sys-x86_64/Makefile +++ b/arch/um/sys-x86_64/Makefile @@ -6,7 +6,7 @@ lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \ - syscalls.o sysrq.o thunk.o sys_call_table.o + syscalls.o sysrq.o thunk.o syscall_table.o USER_OBJS := ptrace_user.o sigcontext.o diff --git a/arch/um/sys-x86_64/sys_call_table.c b/arch/um/sys-x86_64/sys_call_table.c deleted file mode 100644 index a31e0dffb270..000000000000 --- a/arch/um/sys-x86_64/sys_call_table.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) - * Copyright 2003 PathScale, Inc. - * Licensed under the GPL - */ - -#include "linux/config.h" -#include "linux/unistd.h" -#include "linux/sys.h" -#include "linux/swap.h" -#include "linux/syscalls.h" -#include "linux/sysctl.h" -#include "asm/signal.h" -#include "sysdep/syscalls.h" -#include "kern_util.h" - -#define LAST_GENERIC_SYSCALL __NR_keyctl - -#if LAST_GENERIC_SYSCALL > LAST_ARCH_SYSCALL -#define LAST_SYSCALL LAST_GENERIC_SYSCALL -#else -#define LAST_SYSCALL LAST_ARCH_SYSCALL -#endif - -extern syscall_handler_t sys_fork; -extern syscall_handler_t sys_execve; -extern syscall_handler_t um_time; -extern syscall_handler_t um_stime; -extern syscall_handler_t sys_pipe; -extern syscall_handler_t sys_olduname; -extern syscall_handler_t sys_sigaction; -extern syscall_handler_t sys_sigsuspend; -extern syscall_handler_t old_readdir; -extern syscall_handler_t sys_uname; -extern syscall_handler_t sys_ipc; -extern syscall_handler_t sys_sigreturn; -extern syscall_handler_t sys_clone; -extern syscall_handler_t sys_rt_sigreturn; -extern syscall_handler_t sys_sigaltstack; -extern syscall_handler_t sys_vfork; -extern syscall_handler_t old_select; -extern syscall_handler_t sys_modify_ldt; -extern syscall_handler_t sys_rt_sigsuspend; -extern syscall_handler_t sys_mbind; -extern syscall_handler_t sys_get_mempolicy; -extern syscall_handler_t sys_set_mempolicy; -extern syscall_handler_t sys_sys_setaltroot; - -/* On X86-64 all syscalls are aware of 32-bit [ug]ids, so I had to fix this!*/ -syscall_handler_t *sys_call_table[] = { - [ __NR_restart_syscall ] = (syscall_handler_t *) sys_restart_syscall, - [ __NR_exit ] = (syscall_handler_t *) sys_exit, - [ __NR_fork ] = (syscall_handler_t *) sys_fork, - [ __NR_read ] = (syscall_handler_t *) sys_read, - [ __NR_write ] = (syscall_handler_t *) sys_write, - - /* These three are declared differently in asm/unistd.h */ - [ __NR_open ] = (syscall_handler_t *) sys_open, - [ __NR_close ] = (syscall_handler_t *) sys_close, - [ __NR_creat ] = (syscall_handler_t *) sys_creat, - [ __NR_link ] = (syscall_handler_t *) sys_link, - [ __NR_unlink ] = (syscall_handler_t *) sys_unlink, - [ __NR_execve ] = (syscall_handler_t *) sys_execve, - - /* declared differently in kern_util.h */ - [ __NR_chdir ] = (syscall_handler_t *) sys_chdir, - [ __NR_time ] = um_time, - [ __NR_mknod ] = (syscall_handler_t *) sys_mknod, - [ __NR_chmod ] = (syscall_handler_t *) sys_chmod, - [ __NR_lchown ] = (syscall_handler_t *) sys_lchown, - [ __NR_lseek ] = (syscall_handler_t *) sys_lseek, - [ __NR_getpid ] = (syscall_handler_t *) sys_getpid, - [ __NR_mount ] = (syscall_handler_t *) sys_mount, - [ __NR_setuid ] = (syscall_handler_t *) sys_setuid, - [ __NR_getuid ] = (syscall_handler_t *) sys_getuid, - [ __NR_ptrace ] = (syscall_handler_t *) sys_ptrace, - [ __NR_alarm ] = (syscall_handler_t *) sys_alarm, - [ __NR_pause ] = (syscall_handler_t *) sys_pause, - [ __NR_utime ] = (syscall_handler_t *) sys_utime, - [ __NR_access ] = (syscall_handler_t *) sys_access, - [ __NR_sync ] = (syscall_handler_t *) sys_sync, - [ __NR_kill ] = (syscall_handler_t *) sys_kill, - [ __NR_rename ] = (syscall_handler_t *) sys_rename, - [ __NR_mkdir ] = (syscall_handler_t *) sys_mkdir, - [ __NR_rmdir ] = (syscall_handler_t *) sys_rmdir, - - /* Declared differently in asm/unistd.h */ - [ __NR_dup ] = (syscall_handler_t *) sys_dup, - [ __NR_pipe ] = (syscall_handler_t *) sys_pipe, - [ __NR_times ] = (syscall_handler_t *) sys_times, - [ __NR_brk ] = (syscall_handler_t *) sys_brk, - [ __NR_setgid ] = (syscall_handler_t *) sys_setgid, - [ __NR_getgid ] = (syscall_handler_t *) sys_getgid, - [ __NR_geteuid ] = (syscall_handler_t *) sys_geteuid, - [ __NR_getegid ] = (syscall_handler_t *) sys_getegid, - [ __NR_acct ] = (syscall_handler_t *) sys_acct, - [ __NR_umount2 ] = (syscall_handler_t *) sys_umount, - [ __NR_ioctl ] = (syscall_handler_t *) sys_ioctl, - [ __NR_fcntl ] = (syscall_handler_t *) sys_fcntl, - [ __NR_setpgid ] = (syscall_handler_t *) sys_setpgid, - [ __NR_umask ] = (syscall_handler_t *) sys_umask, - [ __NR_chroot ] = (syscall_handler_t *) sys_chroot, - [ __NR_ustat ] = (syscall_handler_t *) sys_ustat, - [ __NR_dup2 ] = (syscall_handler_t *) sys_dup2, - [ __NR_getppid ] = (syscall_handler_t *) sys_getppid, - [ __NR_getpgrp ] = (syscall_handler_t *) sys_getpgrp, - [ __NR_setsid ] = (syscall_handler_t *) sys_setsid, - [ __NR_setreuid ] = (syscall_handler_t *) sys_setreuid, - [ __NR_setregid ] = (syscall_handler_t *) sys_setregid, - [ __NR_sethostname ] = (syscall_handler_t *) sys_sethostname, - [ __NR_setrlimit ] = (syscall_handler_t *) sys_setrlimit, - [ __NR_getrlimit ] = (syscall_handler_t *) sys_getrlimit, - [ __NR_getrusage ] = (syscall_handler_t *) sys_getrusage, - [ __NR_gettimeofday ] = (syscall_handler_t *) sys_gettimeofday, - [ __NR_settimeofday ] = (syscall_handler_t *) sys_settimeofday, - [ __NR_getgroups ] = (syscall_handler_t *) sys_getgroups, - [ __NR_setgroups ] = (syscall_handler_t *) sys_setgroups, - [ __NR_symlink ] = (syscall_handler_t *) sys_symlink, - [ __NR_readlink ] = (syscall_handler_t *) sys_readlink, - [ __NR_uselib ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_swapon ] = (syscall_handler_t *) sys_swapon, - [ __NR_reboot ] = (syscall_handler_t *) sys_reboot, - [ __NR_munmap ] = (syscall_handler_t *) sys_munmap, - [ __NR_truncate ] = (syscall_handler_t *) sys_truncate, - [ __NR_ftruncate ] = (syscall_handler_t *) sys_ftruncate, - [ __NR_fchmod ] = (syscall_handler_t *) sys_fchmod, - [ __NR_fchown ] = (syscall_handler_t *) sys_fchown, - [ __NR_getpriority ] = (syscall_handler_t *) sys_getpriority, - [ __NR_setpriority ] = (syscall_handler_t *) sys_setpriority, - [ __NR_statfs ] = (syscall_handler_t *) sys_statfs, - [ __NR_fstatfs ] = (syscall_handler_t *) sys_fstatfs, - [ __NR_ioperm ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_syslog ] = (syscall_handler_t *) sys_syslog, - [ __NR_setitimer ] = (syscall_handler_t *) sys_setitimer, - [ __NR_getitimer ] = (syscall_handler_t *) sys_getitimer, - [ __NR_stat ] = (syscall_handler_t *) sys_newstat, - [ __NR_lstat ] = (syscall_handler_t *) sys_newlstat, - [ __NR_fstat ] = (syscall_handler_t *) sys_newfstat, - [ __NR_vhangup ] = (syscall_handler_t *) sys_vhangup, - [ __NR_wait4 ] = (syscall_handler_t *) sys_wait4, - [ __NR_swapoff ] = (syscall_handler_t *) sys_swapoff, - [ __NR_sysinfo ] = (syscall_handler_t *) sys_sysinfo, - [ __NR_fsync ] = (syscall_handler_t *) sys_fsync, - [ __NR_clone ] = (syscall_handler_t *) sys_clone, - [ __NR_setdomainname ] = (syscall_handler_t *) sys_setdomainname, - [ __NR_uname ] = (syscall_handler_t *) sys_newuname, - [ __NR_adjtimex ] = (syscall_handler_t *) sys_adjtimex, - [ __NR_mprotect ] = (syscall_handler_t *) sys_mprotect, - [ __NR_create_module ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_init_module ] = (syscall_handler_t *) sys_init_module, - [ __NR_delete_module ] = (syscall_handler_t *) sys_delete_module, - [ __NR_get_kernel_syms ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_quotactl ] = (syscall_handler_t *) sys_quotactl, - [ __NR_getpgid ] = (syscall_handler_t *) sys_getpgid, - [ __NR_fchdir ] = (syscall_handler_t *) sys_fchdir, - [ __NR_sysfs ] = (syscall_handler_t *) sys_sysfs, - [ __NR_personality ] = (syscall_handler_t *) sys_personality, - [ __NR_afs_syscall ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_setfsuid ] = (syscall_handler_t *) sys_setfsuid, - [ __NR_setfsgid ] = (syscall_handler_t *) sys_setfsgid, - [ __NR_getdents ] = (syscall_handler_t *) sys_getdents, - [ __NR_flock ] = (syscall_handler_t *) sys_flock, - [ __NR_msync ] = (syscall_handler_t *) sys_msync, - [ __NR_readv ] = (syscall_handler_t *) sys_readv, - [ __NR_writev ] = (syscall_handler_t *) sys_writev, - [ __NR_getsid ] = (syscall_handler_t *) sys_getsid, - [ __NR_fdatasync ] = (syscall_handler_t *) sys_fdatasync, - [ __NR__sysctl ] = (syscall_handler_t *) sys_sysctl, - [ __NR_mlock ] = (syscall_handler_t *) sys_mlock, - [ __NR_munlock ] = (syscall_handler_t *) sys_munlock, - [ __NR_mlockall ] = (syscall_handler_t *) sys_mlockall, - [ __NR_munlockall ] = (syscall_handler_t *) sys_munlockall, - [ __NR_sched_setparam ] = (syscall_handler_t *) sys_sched_setparam, - [ __NR_sched_getparam ] = (syscall_handler_t *) sys_sched_getparam, - [ __NR_sched_setscheduler ] = (syscall_handler_t *) sys_sched_setscheduler, - [ __NR_sched_getscheduler ] = (syscall_handler_t *) sys_sched_getscheduler, - [ __NR_sched_yield ] = (syscall_handler_t *) yield, - [ __NR_sched_get_priority_max ] = (syscall_handler_t *) sys_sched_get_priority_max, - [ __NR_sched_get_priority_min ] = (syscall_handler_t *) sys_sched_get_priority_min, - [ __NR_sched_rr_get_interval ] = (syscall_handler_t *) sys_sched_rr_get_interval, - [ __NR_nanosleep ] = (syscall_handler_t *) sys_nanosleep, - [ __NR_mremap ] = (syscall_handler_t *) sys_mremap, - [ __NR_setresuid ] = (syscall_handler_t *) sys_setresuid, - [ __NR_getresuid ] = (syscall_handler_t *) sys_getresuid, - [ __NR_query_module ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_poll ] = (syscall_handler_t *) sys_poll, - [ __NR_nfsservctl ] = (syscall_handler_t *) sys_nfsservctl, - [ __NR_setresgid ] = (syscall_handler_t *) sys_setresgid, - [ __NR_getresgid ] = (syscall_handler_t *) sys_getresgid, - [ __NR_prctl ] = (syscall_handler_t *) sys_prctl, - [ __NR_rt_sigreturn ] = (syscall_handler_t *) sys_rt_sigreturn, - [ __NR_rt_sigaction ] = (syscall_handler_t *) sys_rt_sigaction, - [ __NR_rt_sigprocmask ] = (syscall_handler_t *) sys_rt_sigprocmask, - [ __NR_rt_sigpending ] = (syscall_handler_t *) sys_rt_sigpending, - [ __NR_rt_sigtimedwait ] = (syscall_handler_t *) sys_rt_sigtimedwait, - [ __NR_rt_sigqueueinfo ] = (syscall_handler_t *) sys_rt_sigqueueinfo, - [ __NR_rt_sigsuspend ] = (syscall_handler_t *) sys_rt_sigsuspend, - [ __NR_pread64 ] = (syscall_handler_t *) sys_pread64, - [ __NR_pwrite64 ] = (syscall_handler_t *) sys_pwrite64, - [ __NR_chown ] = (syscall_handler_t *) sys_chown, - [ __NR_getcwd ] = (syscall_handler_t *) sys_getcwd, - [ __NR_capget ] = (syscall_handler_t *) sys_capget, - [ __NR_capset ] = (syscall_handler_t *) sys_capset, - [ __NR_sigaltstack ] = (syscall_handler_t *) sys_sigaltstack, - [ __NR_sendfile ] = (syscall_handler_t *) sys_sendfile64, - [ __NR_getpmsg ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_putpmsg ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_vfork ] = (syscall_handler_t *) sys_vfork, - [ __NR_getdents64 ] = (syscall_handler_t *) sys_getdents64, - [ __NR_gettid ] = (syscall_handler_t *) sys_gettid, - [ __NR_readahead ] = (syscall_handler_t *) sys_readahead, - [ __NR_setxattr ] = (syscall_handler_t *) sys_setxattr, - [ __NR_lsetxattr ] = (syscall_handler_t *) sys_lsetxattr, - [ __NR_fsetxattr ] = (syscall_handler_t *) sys_fsetxattr, - [ __NR_getxattr ] = (syscall_handler_t *) sys_getxattr, - [ __NR_lgetxattr ] = (syscall_handler_t *) sys_lgetxattr, - [ __NR_fgetxattr ] = (syscall_handler_t *) sys_fgetxattr, - [ __NR_listxattr ] = (syscall_handler_t *) sys_listxattr, - [ __NR_llistxattr ] = (syscall_handler_t *) sys_llistxattr, - [ __NR_flistxattr ] = (syscall_handler_t *) sys_flistxattr, - [ __NR_removexattr ] = (syscall_handler_t *) sys_removexattr, - [ __NR_lremovexattr ] = (syscall_handler_t *) sys_lremovexattr, - [ __NR_fremovexattr ] = (syscall_handler_t *) sys_fremovexattr, - [ __NR_tkill ] = (syscall_handler_t *) sys_tkill, - [ __NR_futex ] = (syscall_handler_t *) sys_futex, - [ __NR_sched_setaffinity ] = (syscall_handler_t *) sys_sched_setaffinity, - [ __NR_sched_getaffinity ] = (syscall_handler_t *) sys_sched_getaffinity, - [ __NR_io_setup ] = (syscall_handler_t *) sys_io_setup, - [ __NR_io_destroy ] = (syscall_handler_t *) sys_io_destroy, - [ __NR_io_getevents ] = (syscall_handler_t *) sys_io_getevents, - [ __NR_io_submit ] = (syscall_handler_t *) sys_io_submit, - [ __NR_io_cancel ] = (syscall_handler_t *) sys_io_cancel, - [ __NR_exit_group ] = (syscall_handler_t *) sys_exit_group, - [ __NR_lookup_dcookie ] = (syscall_handler_t *) sys_lookup_dcookie, - [ __NR_epoll_create ] = (syscall_handler_t *) sys_epoll_create, - [ __NR_epoll_ctl ] = (syscall_handler_t *) sys_epoll_ctl, - [ __NR_epoll_wait ] = (syscall_handler_t *) sys_epoll_wait, - [ __NR_remap_file_pages ] = (syscall_handler_t *) sys_remap_file_pages, - [ __NR_set_tid_address ] = (syscall_handler_t *) sys_set_tid_address, - [ __NR_timer_create ] = (syscall_handler_t *) sys_timer_create, - [ __NR_timer_settime ] = (syscall_handler_t *) sys_timer_settime, - [ __NR_timer_gettime ] = (syscall_handler_t *) sys_timer_gettime, - [ __NR_timer_getoverrun ] = (syscall_handler_t *) sys_timer_getoverrun, - [ __NR_timer_delete ] = (syscall_handler_t *) sys_timer_delete, - [ __NR_clock_settime ] = (syscall_handler_t *) sys_clock_settime, - [ __NR_clock_gettime ] = (syscall_handler_t *) sys_clock_gettime, - [ __NR_clock_getres ] = (syscall_handler_t *) sys_clock_getres, - [ __NR_clock_nanosleep ] = (syscall_handler_t *) sys_clock_nanosleep, - [ __NR_tgkill ] = (syscall_handler_t *) sys_tgkill, - [ __NR_utimes ] = (syscall_handler_t *) sys_utimes, - [ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64, - [ __NR_vserver ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_mbind ] = (syscall_handler_t *) sys_mbind, - [ __NR_get_mempolicy ] = (syscall_handler_t *) sys_get_mempolicy, - [ __NR_set_mempolicy ] = (syscall_handler_t *) sys_set_mempolicy, - [ __NR_mq_open ] = (syscall_handler_t *) sys_mq_open, - [ __NR_mq_unlink ] = (syscall_handler_t *) sys_mq_unlink, - [ __NR_mq_timedsend ] = (syscall_handler_t *) sys_mq_timedsend, - [ __NR_mq_timedreceive ] = (syscall_handler_t *) sys_mq_timedreceive, - [ __NR_mq_notify ] = (syscall_handler_t *) sys_mq_notify, - [ __NR_mq_getsetattr ] = (syscall_handler_t *) sys_mq_getsetattr, - [ __NR_kexec_load ] = (syscall_handler_t *) sys_ni_syscall, - [ __NR_waitid ] = (syscall_handler_t *) sys_waitid, - [ __NR_add_key ] = (syscall_handler_t *) sys_add_key, - [ __NR_request_key ] = (syscall_handler_t *) sys_request_key, - [ __NR_keyctl ] = (syscall_handler_t *) sys_keyctl, - - ARCH_SYSCALLS - [ LAST_SYSCALL + 1 ... NR_syscalls ] = - (syscall_handler_t *) sys_ni_syscall -}; diff --git a/arch/um/sys-x86_64/syscall_table.c b/arch/um/sys-x86_64/syscall_table.c new file mode 100644 index 000000000000..34b2e842864f --- /dev/null +++ b/arch/um/sys-x86_64/syscall_table.c @@ -0,0 +1,59 @@ +/* System call table for UML/x86-64, copied from arch/x86_64/kernel/syscall.c + * with some changes for UML. */ + +#include +#include +#include +#include + +#define __NO_STUBS + +/* Below you can see, in terms of #define's, the differences between the x86-64 + * and the UML syscall table. */ + +/* Not going to be implemented by UML, since we have no hardware. */ +#define stub_iopl sys_ni_syscall +#define sys_ioperm sys_ni_syscall + +/* The UML TLS problem. Note that x86_64 does not implement this, so the below + * is needed only for the ia32 compatibility. */ +/*#define sys_set_thread_area sys_ni_syscall +#define sys_get_thread_area sys_ni_syscall*/ + +/* For __NR_time. The x86-64 name hopefully will change from sys_time64 to + * sys_time (since the current situation is bogus). I've sent a patch to cleanup + * this. Remove below the obsoleted line. */ +#define sys_time64 um_time +#define sys_time um_time + +/* On UML we call it this way ("old" means it's not mmap2) */ +#define sys_mmap old_mmap +/* On x86-64 sys_uname is actually sys_newuname plus a compatibility trick. + * See arch/x86_64/kernel/sys_x86_64.c */ +#define sys_uname sys_uname64 + +#define stub_clone sys_clone +#define stub_fork sys_fork +#define stub_vfork sys_vfork +#define stub_execve sys_execve +#define stub_rt_sigsuspend sys_rt_sigsuspend +#define stub_sigaltstack sys_sigaltstack +#define stub_rt_sigreturn sys_rt_sigreturn + +#define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ; +#undef _ASM_X86_64_UNISTD_H_ +#include + +#undef __SYSCALL +#define __SYSCALL(nr, sym) [ nr ] = sym, +#undef _ASM_X86_64_UNISTD_H_ + +typedef void (*sys_call_ptr_t)(void); + +extern void sys_ni_syscall(void); + +sys_call_ptr_t sys_call_table[__NR_syscall_max+1] __cacheline_aligned = { + /* Smells like a like a compiler bug -- it doesn't work when the & below is removed. */ + [0 ... __NR_syscall_max] = &sys_ni_syscall, +#include +}; diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index 68205a03364c..15768c96ceb4 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c @@ -14,6 +14,7 @@ #include "asm/prctl.h" /* XXX This should get the constants from libc */ #include "choose-mode.h" +/* XXX: copied from x86-64: arch/x86_64/kernel/sys_x86_64.c */ asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) { unsigned long raddr; @@ -21,6 +22,17 @@ asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) return do_shmat(shmid, shmaddr, shmflg, &raddr) ?: (long) raddr; } +asmlinkage long sys_uname64(struct new_utsname __user * name) +{ + int err; + down_read(&uts_sem); + err = copy_to_user(name, &system_utsname, sizeof (*name)); + up_read(&uts_sem); + if (personality(current->personality) == PER_LINUX32) + err |= copy_to_user(&name->machine, "i686", 5); + return err ? -EFAULT : 0; +} + #ifdef CONFIG_MODE_TT extern int modify_ldt(int func, void *ptr, unsigned long bytecount); -- cgit v1.2.3-59-g8ed1b From b97b77cca627b2e3e6d0015e2e14b1d1c12de0c8 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 1 May 2005 08:58:56 -0700 Subject: [PATCH] uml: redo console locking Fix some console locking problems (including scheduling in atomic) and various reorderings and cleanup in that code. Not yet ready for 2.6.12 probably. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/drivers/chan_kern.c | 16 +- arch/um/drivers/line.c | 318 +++++++++++++++++++++++++--------------- arch/um/drivers/ssl.c | 25 +--- arch/um/drivers/stdio_console.c | 19 +-- arch/um/include/line.h | 36 ++--- 5 files changed, 239 insertions(+), 175 deletions(-) (limited to 'arch/um') diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 1f77deb3fd23..0150038af795 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c @@ -22,7 +22,7 @@ #ifdef CONFIG_NOCONFIG_CHAN static void *not_configged_init(char *str, int device, struct chan_opts *opts) { - printk(KERN_ERR "Using a channel type which is configured out of " + printf(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(NULL); } @@ -30,27 +30,27 @@ static void *not_configged_init(char *str, int device, struct chan_opts *opts) static int not_configged_open(int input, int output, int primary, void *data, char **dev_out) { - printk(KERN_ERR "Using a channel type which is configured out of " + printf(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-ENODEV); } static void not_configged_close(int fd, void *data) { - printk(KERN_ERR "Using a channel type which is configured out of " + printf(KERN_ERR "Using a channel type which is configured out of " "UML\n"); } static int not_configged_read(int fd, char *c_out, void *data) { - printk(KERN_ERR "Using a channel type which is configured out of " + printf(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-EIO); } static int not_configged_write(int fd, const char *buf, int len, void *data) { - printk(KERN_ERR "Using a channel type which is configured out of " + printf(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-EIO); } @@ -58,7 +58,7 @@ static int not_configged_write(int fd, const char *buf, int len, void *data) static int not_configged_console_write(int fd, const char *buf, int len, void *data) { - printk(KERN_ERR "Using a channel type which is configured out of " + printf(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-EIO); } @@ -66,14 +66,14 @@ static int not_configged_console_write(int fd, const char *buf, int len, static int not_configged_window_size(int fd, void *data, unsigned short *rows, unsigned short *cols) { - printk(KERN_ERR "Using a channel type which is configured out of " + printf(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-ENODEV); } static void not_configged_free(void *data) { - printk(KERN_ERR "Using a channel type which is configured out of " + printf(KERN_ERR "Using a channel type which is configured out of " "UML\n"); } diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 6924f273ced9..d0f97127adf6 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -39,19 +39,69 @@ static void line_timer_cb(void *arg) line_interrupt(line->driver->read_irq, arg, NULL); } -static int write_room(struct line *dev) +/* Returns the free space inside the ring buffer of this line. + * + * Should be called while holding line->lock (this does not modify datas). + */ +static int write_room(struct line *line) { int n; - if (dev->buffer == NULL) - return (LINE_BUFSIZE - 1); + if (line->buffer == NULL) + return LINE_BUFSIZE - 1; + + /* This is for the case where the buffer is wrapped! */ + n = line->head - line->tail; - n = dev->head - dev->tail; if (n <= 0) - n = LINE_BUFSIZE + n; - return (n - 1); + n = LINE_BUFSIZE + n; /* The other case */ + return n - 1; +} + +int line_write_room(struct tty_struct *tty) +{ + struct line *line = tty->driver_data; + unsigned long flags; + int room; + + if (tty->stopped) + return 0; + + spin_lock_irqsave(&line->lock, flags); + room = write_room(line); + spin_unlock_irqrestore(&line->lock, flags); + + /*XXX: Warning to remove */ + if (0 == room) + printk(KERN_DEBUG "%s: %s: no room left in buffer\n", + __FUNCTION__,tty->name); + return room; } +int line_chars_in_buffer(struct tty_struct *tty) +{ + struct line *line = tty->driver_data; + unsigned long flags; + int ret; + + spin_lock_irqsave(&line->lock, flags); + + /*write_room subtracts 1 for the needed NULL, so we readd it.*/ + ret = LINE_BUFSIZE - (write_room(line) + 1); + spin_unlock_irqrestore(&line->lock, flags); + + return ret; +} + +/* + * This copies the content of buf into the circular buffer associated with + * this line. + * The return value is the number of characters actually copied, i.e. the ones + * for which there was space: this function is not supposed to ever flush out + * the circular buffer. + * + * Must be called while holding line->lock! + */ static int buffer_data(struct line *line, const char *buf, int len) { int end, room; @@ -70,48 +120,95 @@ static int buffer_data(struct line *line, const char *buf, int len) len = (len > room) ? room : len; end = line->buffer + LINE_BUFSIZE - line->tail; - if(len < end){ + + if (len < end){ memcpy(line->tail, buf, len); line->tail += len; - } - else { + } else { + /* The circular buffer is wrapping */ memcpy(line->tail, buf, end); buf += end; memcpy(line->buffer, buf, len - end); line->tail = line->buffer + len - end; } - return(len); + return len; } +/* + * Flushes the ring buffer to the output channels. That is, write_chan is + * called, passing it line->head as buffer, and an appropriate count. + * + * On exit, returns 1 when the buffer is empty, + * 0 when the buffer is not empty on exit, + * and -errno when an error occurred. + * + * Must be called while holding line->lock!*/ static int flush_buffer(struct line *line) { int n, count; if ((line->buffer == NULL) || (line->head == line->tail)) - return(1); + return 1; if (line->tail < line->head) { + /* line->buffer + LINE_BUFSIZE is the end of the buffer! */ count = line->buffer + LINE_BUFSIZE - line->head; + n = write_chan(&line->chan_list, line->head, count, line->driver->write_irq); if (n < 0) - return(n); - if (n == count) + return n; + if (n == count) { + /* We have flushed from ->head to buffer end, now we + * must flush only from the beginning to ->tail.*/ line->head = line->buffer; - else { + } else { line->head += n; - return(0); + return 0; } } count = line->tail - line->head; n = write_chan(&line->chan_list, line->head, count, line->driver->write_irq); - if(n < 0) return(n); + + if(n < 0) + return n; line->head += n; - return(line->head == line->tail); + return line->head == line->tail; +} + +void line_flush_buffer(struct tty_struct *tty) +{ + struct line *line = tty->driver_data; + unsigned long flags; + int err; + + /*XXX: copied from line_write, verify if it is correct!*/ + if(tty->stopped) + return; + //return 0; + + spin_lock_irqsave(&line->lock, flags); + err = flush_buffer(line); + /*if (err == 1) + err = 0;*/ + spin_unlock_irqrestore(&line->lock, flags); + //return err; +} + +/* We map both ->flush_chars and ->put_char (which go in pair) onto ->flush_buffer + * and ->write. Hope it's not that bad.*/ +void line_flush_chars(struct tty_struct *tty) +{ + line_flush_buffer(tty); +} + +void line_put_char(struct tty_struct *tty, unsigned char ch) +{ + line_write(tty, &ch, sizeof(ch)); } int line_write(struct tty_struct *tty, const unsigned char *buf, int len) @@ -120,38 +217,31 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len) unsigned long flags; int n, err, ret = 0; - if(tty->stopped) return 0; + if(tty->stopped) + return 0; - down(&line->sem); - if(line->head != line->tail){ - local_irq_save(flags); + spin_lock_irqsave(&line->lock, flags); + if (line->head != line->tail) { ret = buffer_data(line, buf, len); err = flush_buffer(line); - local_irq_restore(flags); - if(err <= 0 && (err != -EAGAIN || !ret)) + if (err <= 0 && (err != -EAGAIN || !ret)) ret = err; - } - else { + } else { n = write_chan(&line->chan_list, buf, len, line->driver->write_irq); - if(n < 0){ + if (n < 0) { ret = n; goto out_up; } len -= n; ret += n; - if(len > 0) + if (len > 0) ret += buffer_data(line, buf + n, len); } - out_up: - up(&line->sem); - return(ret); -} - -void line_put_char(struct tty_struct *tty, unsigned char ch) -{ - line_write(tty, &ch, sizeof(ch)); +out_up: + spin_unlock_irqrestore(&line->lock, flags); + return ret; } void line_set_termios(struct tty_struct *tty, struct termios * old) @@ -159,11 +249,6 @@ void line_set_termios(struct tty_struct *tty, struct termios * old) /* nothing */ } -int line_chars_in_buffer(struct tty_struct *tty) -{ - return 0; -} - static struct { int cmd; char *level; @@ -250,7 +335,7 @@ int line_ioctl(struct tty_struct *tty, struct file * file, ret = -ENOIOCTLCMD; break; } - return(ret); + return ret; } static irqreturn_t line_write_interrupt(int irq, void *data, @@ -260,18 +345,23 @@ static irqreturn_t line_write_interrupt(int irq, void *data, struct line *line = tty->driver_data; int err; + /* Interrupts are enabled here because we registered the interrupt with + * SA_INTERRUPT (see line_setup_irq).*/ + + spin_lock_irq(&line->lock); err = flush_buffer(line); - if(err == 0) - return(IRQ_NONE); - else if(err < 0){ + if (err == 0) { + return IRQ_NONE; + } else if(err < 0) { line->head = line->buffer; line->tail = line->buffer; } + spin_unlock_irq(&line->lock); if(tty == NULL) - return(IRQ_NONE); + return IRQ_NONE; - if(test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && + if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && (tty->ldisc.write_wakeup != NULL)) (tty->ldisc.write_wakeup)(tty); @@ -281,9 +371,9 @@ static irqreturn_t line_write_interrupt(int irq, void *data, * writes. */ - if(waitqueue_active(&tty->write_wait)) + if (waitqueue_active(&tty->write_wait)) wake_up_interruptible(&tty->write_wait); - return(IRQ_HANDLED); + return IRQ_HANDLED; } int line_setup_irq(int fd, int input, int output, struct tty_struct *tty) @@ -292,15 +382,18 @@ int line_setup_irq(int fd, int input, int output, struct tty_struct *tty) struct line_driver *driver = line->driver; int err = 0, flags = SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM; - if(input) err = um_request_irq(driver->read_irq, fd, IRQ_READ, + if (input) + err = um_request_irq(driver->read_irq, fd, IRQ_READ, line_interrupt, flags, driver->read_irq_name, tty); - if(err) return(err); - if(output) err = um_request_irq(driver->write_irq, fd, IRQ_WRITE, + if (err) + return err; + if (output) + err = um_request_irq(driver->write_irq, fd, IRQ_WRITE, line_write_interrupt, flags, driver->write_irq_name, tty); line->have_irq = 1; - return(err); + return err; } void line_disable(struct tty_struct *tty, int current_irq) @@ -336,7 +429,9 @@ int line_open(struct line *lines, struct tty_struct *tty, line = &lines[tty->index]; tty->driver_data = line; - down(&line->sem); + /* The IRQ which takes this lock is not yet enabled and won't be run + * before the end, so we don't need to use spin_lock_irq.*/ + spin_lock(&line->lock); if (tty->count == 1) { if (!line->valid) { err = -ENODEV; @@ -349,6 +444,7 @@ int line_open(struct line *lines, struct tty_struct *tty, err = open_chan(&line->chan_list); if(err) goto out; } + /* Here the interrupt is registered.*/ enable_chan(&line->chan_list, tty); INIT_WORK(&line->task, line_timer_cb, tty); } @@ -362,21 +458,27 @@ int line_open(struct line *lines, struct tty_struct *tty, line->count++; out: - up(&line->sem); - return(err); + spin_unlock(&line->lock); + return err; } void line_close(struct tty_struct *tty, struct file * filp) { struct line *line = tty->driver_data; - down(&line->sem); + /* XXX: I assume this should be called in process context, not with interrupt + * disabled!*/ + spin_lock_irq(&line->lock); + + /* We ignore the error anyway! */ + flush_buffer(line); + line->count--; if (tty->count == 1) { line_disable(tty, -1); tty->driver_data = NULL; } - up(&line->sem); + spin_unlock_irq(&line->lock); } void close_lines(struct line *lines, int nlines) @@ -387,31 +489,41 @@ void close_lines(struct line *lines, int nlines) close_chan(&lines[i].chan_list); } -int line_setup(struct line *lines, int num, char *init, int all_allowed) +/* Common setup code for both startup command line and mconsole initialization. + * @lines contains the the array (of size @num) to modify; + * @init is the setup string; + * @all_allowed is a boolean saying if we can setup the whole @lines + * at once. For instance, it will be usually true for startup init. (where we + * can use con=xterm) and false for mconsole.*/ + +int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed) { int i, n; char *end; - if(*init == '=') n = -1; - else { + if(*init == '=') { + /* We said con=/ssl= instead of con#=, so we are configuring all + * consoles at once.*/ + n = -1; + } else { n = simple_strtoul(init, &end, 0); if(*end != '='){ printk(KERN_ERR "line_setup failed to parse \"%s\"\n", init); - return(0); + return 0; } init = end; } init++; - if((n >= 0) && (n >= num)){ + + if (n >= (signed int) num) { printk("line_setup - %d out of range ((0 ... %d) allowed)\n", n, num - 1); - return(0); - } - else if (n >= 0){ + return 0; + } else if (n >= 0){ if (lines[n].count > 0) { printk("line_setup - device %d is open\n", n); - return(0); + return 0; } if (lines[n].init_pri <= INIT_ONE){ lines[n].init_pri = INIT_ONE; @@ -422,13 +534,11 @@ int line_setup(struct line *lines, int num, char *init, int all_allowed) lines[n].valid = 1; } } - } - else if(!all_allowed){ + } else if(!all_allowed){ printk("line_setup - can't configure all devices from " "mconsole\n"); - return(0); - } - else { + return 0; + } else { for(i = 0; i < num; i++){ if(lines[i].init_pri <= INIT_ALL){ lines[i].init_pri = INIT_ALL; @@ -440,21 +550,21 @@ int line_setup(struct line *lines, int num, char *init, int all_allowed) } } } - return(1); + return 1; } -int line_config(struct line *lines, int num, char *str) +int line_config(struct line *lines, unsigned int num, char *str) { char *new = uml_strdup(str); if(new == NULL){ printk("line_config - uml_strdup failed\n"); - return(-ENOMEM); + return -ENOMEM; } - return(!line_setup(lines, num, new, 0)); + return !line_setup(lines, num, new, 0); } -int line_get_config(char *name, struct line *lines, int num, char *str, +int line_get_config(char *name, struct line *lines, unsigned int num, char *str, int size, char **error_out) { struct line *line; @@ -464,47 +574,33 @@ int line_get_config(char *name, struct line *lines, int num, char *str, dev = simple_strtoul(name, &end, 0); if((*end != '\0') || (end == name)){ *error_out = "line_get_config failed to parse device number"; - return(0); + return 0; } if((dev < 0) || (dev >= num)){ - *error_out = "device number of of range"; - return(0); + *error_out = "device number out of range"; + return 0; } line = &lines[dev]; - down(&line->sem); + spin_lock(&line->lock); if(!line->valid) CONFIG_CHUNK(str, size, n, "none", 1); else if(line->count == 0) CONFIG_CHUNK(str, size, n, line->init_str, 1); else n = chan_config_string(&line->chan_list, str, size, error_out); - up(&line->sem); + spin_unlock(&line->lock); - return(n); + return n; } -int line_remove(struct line *lines, int num, char *str) +int line_remove(struct line *lines, unsigned int num, char *str) { char config[sizeof("conxxxx=none\0")]; sprintf(config, "%s=none", str); - return(!line_setup(lines, num, config, 0)); -} - -int line_write_room(struct tty_struct *tty) -{ - struct line *dev = tty->driver_data; - int room; - - if (tty->stopped) - return 0; - room = write_room(dev); - if (0 == room) - printk(KERN_DEBUG "%s: %s: no room left in buffer\n", - __FUNCTION__,tty->name); - return room; + return !line_setup(lines, num, config, 0); } struct tty_driver *line_register_devfs(struct lines *set, @@ -553,7 +649,7 @@ void lines_init(struct line *lines, int nlines) for(i = 0; i < nlines; i++){ line = &lines[i]; INIT_LIST_HEAD(&line->chan_list); - sema_init(&line->sem, 1); + spin_lock_init(&line->lock); if(line->init_str != NULL){ line->init_str = uml_strdup(line->init_str); if(line->init_str == NULL) @@ -587,7 +683,7 @@ irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused) "errno = %d\n", -err); printk("fd %d is losing SIGWINCH support\n", winch->tty_fd); - return(IRQ_HANDLED); + return IRQ_HANDLED; } goto out; } @@ -603,7 +699,7 @@ irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused) out: if(winch->fd != -1) reactivate_fd(winch->fd, WINCH_IRQ); - return(IRQ_HANDLED); + return IRQ_HANDLED; } DECLARE_MUTEX(winch_handler_sem); @@ -625,7 +721,7 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty) .pid = pid, .tty = tty }); list_add(&winch->list, &winch_handlers); - if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, + if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM, "winch", winch) < 0) printk("register_winch_irq - failed to register IRQ\n"); @@ -656,26 +752,16 @@ char *add_xterm_umid(char *base) int len; umid = get_umid(1); - if(umid == NULL) return(base); + if(umid == NULL) + return base; len = strlen(base) + strlen(" ()") + strlen(umid) + 1; title = kmalloc(len, GFP_KERNEL); if(title == NULL){ printk("Failed to allocate buffer for xterm title\n"); - return(base); + return base; } snprintf(title, len, "%s (%s)", base, umid); - return(title); + return title; } - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index c5839c3141f8..a2bac429f3d4 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c @@ -107,11 +107,6 @@ int ssl_open(struct tty_struct *tty, struct file *filp) } #if 0 -static int ssl_chars_in_buffer(struct tty_struct *tty) -{ - return(0); -} - static void ssl_flush_buffer(struct tty_struct *tty) { return; @@ -149,11 +144,11 @@ static struct tty_operations ssl_ops = { .put_char = line_put_char, .write_room = line_write_room, .chars_in_buffer = line_chars_in_buffer, + .flush_buffer = line_flush_buffer, + .flush_chars = line_flush_chars, .set_termios = line_set_termios, .ioctl = line_ioctl, #if 0 - .flush_chars = ssl_flush_chars, - .flush_buffer = ssl_flush_buffer, .throttle = ssl_throttle, .unthrottle = ssl_unthrottle, .stop = ssl_stop, @@ -171,10 +166,11 @@ static void ssl_console_write(struct console *c, const char *string, unsigned len) { struct line *line = &serial_lines[c->index]; + unsigned long flags; - down(&line->sem); + spin_lock_irqsave(&line->lock, flags); console_write_chan(&line->chan_list, string, len); - up(&line->sem); + spin_unlock_irqrestore(&line->lock, flags); } static struct tty_driver *ssl_console_device(struct console *c, int *index) @@ -238,14 +234,3 @@ static int ssl_chan_setup(char *str) __setup("ssl", ssl_chan_setup); __channel_help(ssl_chan_setup, "ssl"); - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index e604d7c87695..361d0be342b3 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c @@ -116,8 +116,11 @@ static struct tty_operations console_ops = { .open = con_open, .close = line_close, .write = line_write, + .put_char = line_put_char, .write_room = line_write_room, .chars_in_buffer = line_chars_in_buffer, + .flush_buffer = line_flush_buffer, + .flush_chars = line_flush_chars, .set_termios = line_set_termios, .ioctl = line_ioctl, }; @@ -126,10 +129,11 @@ static void uml_console_write(struct console *console, const char *string, unsigned len) { struct line *line = &vts[console->index]; + unsigned long flags; - down(&line->sem); + spin_lock_irqsave(&line->lock, flags); console_write_chan(&line->chan_list, string, len); - up(&line->sem); + spin_unlock_irqrestore(&line->lock, flags); } static struct tty_driver *uml_console_device(struct console *c, int *index) @@ -192,14 +196,3 @@ static int console_chan_setup(char *str) } __setup("con", console_chan_setup); __channel_help(console_chan_setup, "con"); - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/arch/um/include/line.h b/arch/um/include/line.h index 6d81ecc17be5..4c5e92c04ccb 100644 --- a/arch/um/include/line.h +++ b/arch/um/include/line.h @@ -10,7 +10,7 @@ #include "linux/workqueue.h" #include "linux/tty.h" #include "linux/interrupt.h" -#include "asm/semaphore.h" +#include "linux/spinlock.h" #include "chan_user.h" #include "mconsole_kern.h" @@ -37,10 +37,18 @@ struct line { struct list_head chan_list; int valid; int count; - struct semaphore sem; + /*This lock is actually, mostly, local to*/ + spinlock_t lock; + + /* Yes, this is a real circular buffer. + * XXX: And this should become a struct kfifo! + * + * buffer points to a buffer allocated on demand, of length + * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/ char *buffer; char *head; char *tail; + int sigio; struct work_struct task; struct line_driver *driver; @@ -52,7 +60,6 @@ struct line { init_pri : INIT_STATIC, \ chan_list : { }, \ valid : 1, \ - sem : { }, \ buffer : NULL, \ head : NULL, \ tail : NULL, \ @@ -69,15 +76,18 @@ struct lines { extern void line_close(struct tty_struct *tty, struct file * filp); extern int line_open(struct line *lines, struct tty_struct *tty, struct chan_opts *opts); -extern int line_setup(struct line *lines, int num, char *init, +extern int line_setup(struct line *lines, unsigned int sizeof_lines, char *init, int all_allowed); extern int line_write(struct tty_struct *tty, const unsigned char *buf, int len); extern void line_put_char(struct tty_struct *tty, unsigned char ch); extern void line_set_termios(struct tty_struct *tty, struct termios * old); extern int line_chars_in_buffer(struct tty_struct *tty); +extern void line_flush_buffer(struct tty_struct *tty); +extern void line_flush_chars(struct tty_struct *tty); extern int line_write_room(struct tty_struct *tty); extern int line_ioctl(struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg); + extern char *add_xterm_umid(char *base); extern int line_setup_irq(int fd, int input, int output, struct tty_struct *tty); extern void line_close_chan(struct line *line); @@ -89,20 +99,10 @@ extern struct tty_driver * line_register_devfs(struct lines *set, int nlines); extern void lines_init(struct line *lines, int nlines); extern void close_lines(struct line *lines, int nlines); -extern int line_config(struct line *lines, int num, char *str); -extern int line_remove(struct line *lines, int num, char *str); -extern int line_get_config(char *dev, struct line *lines, int num, char *str, + +extern int line_config(struct line *lines, unsigned int sizeof_lines, char *str); +extern int line_remove(struct line *lines, unsigned int sizeof_lines, char *str); +extern int line_get_config(char *dev, struct line *lines, unsigned int sizeof_lines, char *str, int size, char **error_out); #endif - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ -- cgit v1.2.3-59-g8ed1b From 2c49be99ede1e3685a9817a564b4b1678d48e1b9 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 1 May 2005 08:58:57 -0700 Subject: [PATCH] uml ubd: handle readonly status Use the set_disk_ro() API when the backing file is read-only, to mark the disk read-only, during the ->open(). The current hack does not work when doing a mount -o remount. Also, mark explicitly the code paths which should no more be triggerable (I've removed the WARN_ON(1) things). They should actually become BUG()s probably but I'll avoid that since I'm not so sure the change works so well. I gave it only some limited testing. Signed-off-by: Paolo 'Blaisorblade' Giarrusso CC: Jens Axboe Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/drivers/ubd_kern.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'arch/um') diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 4d8b165bfa48..9a56ff94308d 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -156,6 +156,7 @@ static struct gendisk *fake_gendisk[MAX_DEV]; static struct openflags global_openflags = OPEN_FLAGS; struct cow { + /* This is the backing file, actually */ char *file; int fd; unsigned long *bitmap; @@ -927,10 +928,14 @@ static int ubd_open(struct inode *inode, struct file *filp) } } dev->count++; - if((filp->f_mode & FMODE_WRITE) && !dev->openflags.w){ + set_disk_ro(disk, !dev->openflags.w); + + /* This should no more be needed. And it didn't work anyway to exclude + * read-write remounting of filesystems.*/ + /*if((filp->f_mode & FMODE_WRITE) && !dev->openflags.w){ if(--dev->count == 0) ubd_close(dev); err = -EROFS; - } + }*/ out: return(err); } @@ -1096,6 +1101,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req) if(req->rq_status == RQ_INACTIVE) return(1); + /* This should be impossible now */ if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ printk("Write attempted on readonly ubd device %s\n", disk->disk_name); @@ -1243,6 +1249,7 @@ static int ubd_check_remapped(int fd, unsigned long address, int is_write, /* It's a write to a ubd device */ + /* This should be impossible now */ if(!dev->openflags.w){ /* It's a write access on a read-only device - probably * shouldn't happen. If the kernel is trying to change @@ -1605,8 +1612,7 @@ void do_io(struct io_thread_req *req) } } while((n < len) && (n != 0)); if (n < len) memset(&buf[n], 0, len - n); - } - else { + } else { n = os_write_file(req->fds[bit], buf, len); if(n != len){ printk("do_io - write failed err = %d " -- cgit v1.2.3-59-g8ed1b From e49332bd12e92da2df6d002f857ec62675ba2648 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Sun, 1 May 2005 08:59:08 -0700 Subject: [PATCH] misc verify_area cleanups There were still a few comments left refering to verify_area, and two functions, verify_area_skas & verify_area_tt that just wrap corresponding access_ok_skas & access_ok_tt functions, just like verify_area does for access_ok - deprecate those. There was also a few places that still used verify_area in commented-out code, fix those up to use access_ok. After applying this one there should not be anything left but finally removing verify_area completely, which will happen after a kernel release or two. Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/i386/kernel/vm86.c | 2 +- arch/um/kernel/skas/include/uaccess-skas.h | 2 +- arch/um/kernel/tt/include/uaccess-tt.h | 2 +- drivers/char/dtlk.c | 2 +- drivers/char/specialix.c | 11 ++++------- include/asm-frv/pgtable.h | 4 ++-- include/asm-i386/checksum.h | 2 +- include/asm-i386/pgtable.h | 4 ++-- include/asm-parisc/uaccess.h | 2 +- include/asm-sh/checksum.h | 2 +- include/asm-sh64/checksum.h | 2 +- include/asm-sparc/uaccess.h | 2 +- net/8021q/vlanproc.c | 2 +- net/atm/common.c | 4 ++-- net/core/iovec.c | 2 +- net/wanrouter/wanmain.c | 4 ++-- 16 files changed, 23 insertions(+), 26 deletions(-) (limited to 'arch/um') diff --git a/arch/i386/kernel/vm86.c b/arch/i386/kernel/vm86.c index d3b4c540eb64..ec0f68ce6886 100644 --- a/arch/i386/kernel/vm86.c +++ b/arch/i386/kernel/vm86.c @@ -222,7 +222,7 @@ asmlinkage int sys_vm86(struct pt_regs regs) goto out; case VM86_PLUS_INSTALL_CHECK: /* NOTE: on old vm86 stuff this will return the error - from verify_area(), because the subfunction is + from access_ok(), because the subfunction is interpreted as (invalid) address to vm86_struct. So the installation check works. */ diff --git a/arch/um/kernel/skas/include/uaccess-skas.h b/arch/um/kernel/skas/include/uaccess-skas.h index 11986c9b9ddf..c35620385da0 100644 --- a/arch/um/kernel/skas/include/uaccess-skas.h +++ b/arch/um/kernel/skas/include/uaccess-skas.h @@ -18,7 +18,7 @@ ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \ ((unsigned long) (addr) + (size) >= (unsigned long)(addr)))) -static inline int verify_area_skas(int type, const void * addr, +static inline int __deprecated verify_area_skas(int type, const void * addr, unsigned long size) { return(access_ok_skas(type, addr, size) ? 0 : -EFAULT); diff --git a/arch/um/kernel/tt/include/uaccess-tt.h b/arch/um/kernel/tt/include/uaccess-tt.h index f0bad010cebd..bb69d6b7d022 100644 --- a/arch/um/kernel/tt/include/uaccess-tt.h +++ b/arch/um/kernel/tt/include/uaccess-tt.h @@ -33,7 +33,7 @@ extern unsigned long uml_physmem; (((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \ (under_task_size(addr, size) || is_stack(addr, size)))) -static inline int verify_area_tt(int type, const void * addr, +static inline int __deprecated verify_area_tt(int type, const void * addr, unsigned long size) { return(access_ok_tt(type, addr, size) ? 0 : -EFAULT); diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index 903e4c3cc209..a229915ce1b2 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c @@ -52,7 +52,7 @@ #define KERNEL #include #include -#include /* for verify_area */ +#include #include /* for -EBUSY */ #include /* for request_region */ #include /* for loops_per_jiffy */ diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index c789d5ceac76..50e0b612a8a2 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -1987,10 +1987,9 @@ static inline int sx_set_serial_info(struct specialix_port * port, func_enter(); /* - error = verify_area(VERIFY_READ, (void *) newinfo, sizeof(tmp)); - if (error) { + if (!access_ok(VERIFY_READ, (void *) newinfo, sizeof(tmp))) { func_exit(); - return error; + return -EFAULT; } */ if (copy_from_user(&tmp, newinfo, sizeof(tmp))) { @@ -2046,14 +2045,12 @@ static inline int sx_get_serial_info(struct specialix_port * port, { struct serial_struct tmp; struct specialix_board *bp = port_Board(port); - // int error; func_enter(); /* - error = verify_area(VERIFY_WRITE, (void *) retinfo, sizeof(tmp)); - if (error) - return error; + if (!access_ok(VERIFY_WRITE, (void *) retinfo, sizeof(tmp))) + return -EFAULT; */ memset(&tmp, 0, sizeof(tmp)); diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h index 3c6d42a22dfe..d0a9c2f9c13e 100644 --- a/include/asm-frv/pgtable.h +++ b/include/asm-frv/pgtable.h @@ -349,9 +349,9 @@ static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address) /* * Define this to warn about kernel memory accesses that are - * done without a 'verify_area(VERIFY_WRITE,..)' + * done without a 'access_ok(VERIFY_WRITE,..)' */ -#undef TEST_VERIFY_AREA +#undef TEST_ACCESS_OK #define pte_present(x) (pte_val(x) & _PAGE_PRESENT) #define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) diff --git a/include/asm-i386/checksum.h b/include/asm-i386/checksum.h index d76a5f081c91..641342002bcd 100644 --- a/include/asm-i386/checksum.h +++ b/include/asm-i386/checksum.h @@ -33,7 +33,7 @@ asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsi * passed in an incorrect kernel address to one of these functions. * * If you use these functions directly please don't forget the - * verify_area(). + * access_ok(). */ static __inline__ unsigned int csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 5c725425d863..8d60c2b4b003 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -193,9 +193,9 @@ extern unsigned long long __PAGE_KERNEL, __PAGE_KERNEL_EXEC; /* * Define this if things work differently on an i386 and an i486: * it will (on an i486) warn about kernel memory accesses that are - * done without a 'verify_area(VERIFY_WRITE,..)' + * done without a 'access_ok(VERIFY_WRITE,..)' */ -#undef TEST_VERIFY_AREA +#undef TEST_ACCESS_OK /* The boot page tables (all created as a single array) */ extern unsigned long pg0[]; diff --git a/include/asm-parisc/uaccess.h b/include/asm-parisc/uaccess.h index 8a08423b7570..c1b5bdea53ee 100644 --- a/include/asm-parisc/uaccess.h +++ b/include/asm-parisc/uaccess.h @@ -24,7 +24,7 @@ /* * Note that since kernel addresses are in a separate address space on - * parisc, we don't need to do anything for access_ok() or verify_area(). + * parisc, we don't need to do anything for access_ok(). * We just let the page fault handler do the right thing. This also means * that put_user is the same as __put_user, etc. */ diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h index 5113c7f8a739..5ebd0f24299e 100644 --- a/include/asm-sh/checksum.h +++ b/include/asm-sh/checksum.h @@ -42,7 +42,7 @@ asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsi * passed in an incorrect kernel address to one of these functions. * * If you use these functions directly please don't forget the - * verify_area(). + * access_ok(). */ static __inline__ unsigned int csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, diff --git a/include/asm-sh64/checksum.h b/include/asm-sh64/checksum.h index aa3911a99490..fd034e9ae6e3 100644 --- a/include/asm-sh64/checksum.h +++ b/include/asm-sh64/checksum.h @@ -34,7 +34,7 @@ asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, * passed in an incorrect kernel address to one of these functions. * * If you use these functions directly please don't forget the - * verify_area(). + * access_ok(). */ diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h index 3f47889883b7..f461144067ee 100644 --- a/include/asm-sparc/uaccess.h +++ b/include/asm-sparc/uaccess.h @@ -18,7 +18,7 @@ #ifndef __ASSEMBLY__ -/* Sparc is not segmented, however we need to be able to fool verify_area() +/* Sparc is not segmented, however we need to be able to fool access_ok() * when doing system calls from kernel mode legitimately. * * "For historical reasons, these macros are grossly misnamed." -Linus diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index c32d27af0a3f..7b214cffc956 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c @@ -23,7 +23,7 @@ #include /* return codes */ #include #include /* kmalloc(), kfree() */ -#include /* verify_area(), etc. */ +#include #include /* inline mem*, str* functions */ #include /* __initfunc et al. */ #include /* htons(), etc. */ diff --git a/net/atm/common.c b/net/atm/common.c index 6d16be334ea0..e93e838069e8 100644 --- a/net/atm/common.c +++ b/net/atm/common.c @@ -12,7 +12,7 @@ #include /* SOL_SOCKET */ #include /* error codes */ #include -#include /* verify_area */ +#include #include #include /* struct timeval */ #include @@ -540,7 +540,7 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, error = -EMSGSIZE; goto out; } - /* verify_area is done by net/socket.c */ + eff = (size+3) & ~3; /* align to word boundary */ prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); error = 0; diff --git a/net/core/iovec.c b/net/core/iovec.c index d57ace949ab8..65e4b56fbc77 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c @@ -33,7 +33,7 @@ * Verify iovec. The caller must ensure that the iovec is big enough * to hold the message iovec. * - * Save time not doing verify_area. copy_*_user will make this work + * Save time not doing access_ok. copy_*_user will make this work * in any case. */ diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index 956c17f6c548..d6844ac226f5 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c @@ -48,8 +48,8 @@ #include #include #include /* support for loadable modules */ -#include /* kmalloc(), kfree() */ -#include /* verify_area(), etc. */ +#include /* kmalloc(), kfree() */ +#include #include /* inline mem*, str* functions */ #include /* htons(), etc. */ -- cgit v1.2.3-59-g8ed1b From 7d87e14c236d6c4cab66d87cf0bc1e0f0375d308 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Sun, 1 May 2005 08:59:12 -0700 Subject: [PATCH] consolidate sys_shmat Signed-off-by: Stephen Rothwell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/alpha/kernel/osf_sys.c | 16 ---------------- arch/alpha/kernel/systbls.S | 2 +- arch/arm/kernel/sys_arm.c | 12 ------------ arch/ia64/kernel/entry.S | 2 +- arch/ia64/kernel/sys_ia64.c | 14 -------------- arch/mips/kernel/syscall.c | 16 ---------------- arch/parisc/kernel/sys_parisc.c | 11 ----------- arch/parisc/kernel/syscall_table.S | 2 +- arch/sh64/kernel/sys_sh64.c | 15 --------------- arch/sh64/kernel/syscalls.S | 2 +- arch/um/include/sysdep-x86_64/syscalls.h | 1 - arch/um/sys-x86_64/syscalls.c | 8 -------- arch/x86_64/kernel/sys_x86_64.c | 6 ------ include/asm-x86_64/unistd.h | 2 +- include/linux/syscalls.h | 3 +-- ipc/shm.c | 14 ++++++++++++++ kernel/sys_ni.c | 1 + 17 files changed, 21 insertions(+), 106 deletions(-) (limited to 'arch/um') diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index b5d0fd2bb10a..64e450dddb49 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c @@ -457,22 +457,6 @@ osf_getdomainname(char __user *name, int namelen) return 0; } -asmlinkage long -osf_shmat(int shmid, void __user *shmaddr, int shmflg) -{ - unsigned long raddr; - long err; - - err = do_shmat(shmid, shmaddr, shmflg, &raddr); - - /* - * This works because all user-level addresses are - * non-negative longs! - */ - return err ? err : (long)raddr; -} - - /* * The following stuff should move into a header file should it ever * be labeled "officially supported." Right now, there is just enough diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index 3864b33562ee..052120882876 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S @@ -227,7 +227,7 @@ sys_call_table: .quad sys_semop .quad osf_utsname .quad sys_lchown - .quad osf_shmat + .quad sys_shmat .quad sys_shmctl /* 210 */ .quad sys_shmdt .quad sys_shmget diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index 7ba6342cf93d..ef32577da304 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c @@ -227,18 +227,6 @@ asmlinkage int sys_ipc(uint call, int first, int second, int third, } } -asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg, - unsigned long __user *addr) -{ - unsigned long ret; - long err; - - err = do_shmat(shmid, shmaddr, shmflg, &ret); - if (err == 0) - err = put_user(ret, addr); - return err; -} - /* Fork a new task - this creates a new program thread. * This is called indirectly via a small wrapper */ diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index bd86fea49a0c..d3f093820bc7 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S @@ -1417,7 +1417,7 @@ sys_call_table: data8 sys_msgrcv data8 sys_msgctl data8 sys_shmget - data8 ia64_shmat + data8 sys_shmat data8 sys_shmdt // 1115 data8 sys_shmctl data8 sys_syslog diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index 3ac216e1c8bb..a8cf6d8a509c 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c @@ -92,20 +92,6 @@ sys_getpagesize (void) return PAGE_SIZE; } -asmlinkage unsigned long -ia64_shmat (int shmid, void __user *shmaddr, int shmflg) -{ - unsigned long raddr; - int retval; - - retval = do_shmat(shmid, shmaddr, shmflg, &raddr); - if (retval < 0) - return retval; - - force_successful_syscall_return(); - return raddr; -} - asmlinkage unsigned long ia64_brk (unsigned long brk) { diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 598bfe7426a2..ae2a1312d4ef 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -373,22 +373,6 @@ asmlinkage int sys_ipc (uint call, int first, int second, } } -/* - * Native ABI that is O32 or N64 version - */ -asmlinkage long sys_shmat(int shmid, char __user *shmaddr, - int shmflg, unsigned long *addr) -{ - unsigned long raddr; - int err; - - err = do_shmat(shmid, shmaddr, shmflg, &raddr); - if (err) - return err; - - return put_user(raddr, addr); -} - /* * No implemented yet ... */ diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index 7958cd8c8bf8..d15a1d53e101 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c @@ -161,17 +161,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, } } -long sys_shmat_wrapper(int shmid, char __user *shmaddr, int shmflag) -{ - unsigned long raddr; - int r; - - r = do_shmat(shmid, shmaddr, shmflag, &raddr); - if (r < 0) - return r; - return raddr; -} - /* Fucking broken ABI */ #ifdef CONFIG_64BIT diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 779b537100ec..dcfa4d3d0e7d 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S @@ -297,7 +297,7 @@ ENTRY_DIFF(msgrcv) ENTRY_SAME(msgget) /* 190 */ ENTRY_SAME(msgctl) - ENTRY_SAME(shmat_wrapper) + ENTRY_SAME(shmat) ENTRY_SAME(shmdt) ENTRY_SAME(shmget) ENTRY_SAME(shmctl) /* 195 */ diff --git a/arch/sh64/kernel/sys_sh64.c b/arch/sh64/kernel/sys_sh64.c index 4546845b9caf..58ff7d522d81 100644 --- a/arch/sh64/kernel/sys_sh64.c +++ b/arch/sh64/kernel/sys_sh64.c @@ -283,18 +283,3 @@ asmlinkage int sys_uname(struct old_utsname * name) up_read(&uts_sem); return err?-EFAULT:0; } - -/* Copy from mips version */ -asmlinkage long sys_shmatcall(int shmid, char __user *shmaddr, - int shmflg) -{ - unsigned long raddr; - int err; - - err = do_shmat(shmid, shmaddr, shmflg, &raddr); - if (err) - return err; - - err = raddr; - return err; -} diff --git a/arch/sh64/kernel/syscalls.S b/arch/sh64/kernel/syscalls.S index 8ed417df3dc6..6aabc63e4518 100644 --- a/arch/sh64/kernel/syscalls.S +++ b/arch/sh64/kernel/syscalls.S @@ -268,7 +268,7 @@ sys_call_table: .long sys_msgrcv .long sys_msgget .long sys_msgctl - .long sys_shmatcall + .long sys_shmat .long sys_shmdt /* 245 */ .long sys_shmget .long sys_shmctl diff --git a/arch/um/include/sysdep-x86_64/syscalls.h b/arch/um/include/sysdep-x86_64/syscalls.h index b56b335c3514..67923cca5691 100644 --- a/arch/um/include/sysdep-x86_64/syscalls.h +++ b/arch/um/include/sysdep-x86_64/syscalls.h @@ -26,7 +26,6 @@ extern syscall_handler_t *ia32_sys_call_table[]; extern long old_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff); -extern syscall_handler_t wrap_sys_shmat; extern syscall_handler_t sys_modify_ldt; extern syscall_handler_t sys_arch_prctl; diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index 15768c96ceb4..ab4b0abf8af3 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c @@ -14,14 +14,6 @@ #include "asm/prctl.h" /* XXX This should get the constants from libc */ #include "choose-mode.h" -/* XXX: copied from x86-64: arch/x86_64/kernel/sys_x86_64.c */ -asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) -{ - unsigned long raddr; - - return do_shmat(shmid, shmaddr, shmflg, &raddr) ?: (long) raddr; -} - asmlinkage long sys_uname64(struct new_utsname __user * name) { int err; diff --git a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c index 477d8be57d64..dbebd5ccba6b 100644 --- a/arch/x86_64/kernel/sys_x86_64.c +++ b/arch/x86_64/kernel/sys_x86_64.c @@ -152,12 +152,6 @@ asmlinkage long sys_uname(struct new_utsname __user * name) return err ? -EFAULT : 0; } -asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) -{ - unsigned long raddr; - return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr; -} - asmlinkage long sys_time64(long __user * tloc) { struct timeval now; diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 3d65d240dc95..3c9af6fd4332 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h @@ -76,7 +76,7 @@ __SYSCALL(__NR_madvise, sys_madvise) #define __NR_shmget 29 __SYSCALL(__NR_shmget, sys_shmget) #define __NR_shmat 30 -__SYSCALL(__NR_shmat, wrap_sys_shmat) +__SYSCALL(__NR_shmat, sys_shmat) #define __NR_shmctl 31 __SYSCALL(__NR_shmctl, sys_shmctl) diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 757cd9be7743..c39f6f72cbbc 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -456,8 +456,7 @@ asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg); asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, unsigned nsops, const struct timespec __user *timeout); -asmlinkage long sys_shmat(int shmid, char __user *shmaddr, - int shmflg, unsigned long __user *addr); +asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg); asmlinkage long sys_shmget(key_t key, size_t size, int flag); asmlinkage long sys_shmdt(char __user *shmaddr); asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); diff --git a/ipc/shm.c b/ipc/shm.c index 06cd5c91056f..cce022435dbc 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -28,6 +28,8 @@ #include #include #include +#include + #include #include "util.h" @@ -771,6 +773,18 @@ out: return err; } +asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg) +{ + unsigned long ret; + long err; + + err = do_shmat(shmid, shmaddr, shmflg, &ret); + if (err) + return err; + force_successful_syscall_return(); + return (long)ret; +} + /* * detach and kill segment if marked destroyed. * The work is done in shm_close. diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index 1802a311dd3f..0dda70ed1f98 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -52,6 +52,7 @@ cond_syscall(sys_msgsnd); cond_syscall(sys_msgrcv); cond_syscall(sys_msgctl); cond_syscall(sys_shmget); +cond_syscall(sys_shmat); cond_syscall(sys_shmdt); cond_syscall(sys_shmctl); cond_syscall(sys_mq_open); -- cgit v1.2.3-59-g8ed1b From 7ed20e1ad521b5f5df61bf6559ae60738e393741 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Sun, 1 May 2005 08:59:14 -0700 Subject: [PATCH] convert that currently tests _NSIG directly to use valid_signal() Convert most of the current code that uses _NSIG directly to instead use valid_signal(). This avoids gcc -W warnings and off-by-one errors. Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/alpha/kernel/ptrace.c | 5 +++-- arch/arm/kernel/ptrace.c | 5 +++-- arch/arm26/kernel/ptrace.c | 5 +++-- arch/cris/arch-v10/kernel/ptrace.c | 5 +++-- arch/frv/kernel/ptrace.c | 5 +++-- arch/h8300/kernel/ptrace.c | 5 +++-- arch/i386/kernel/ptrace.c | 5 +++-- arch/ia64/kernel/ptrace.c | 5 +++-- arch/m32r/kernel/ptrace.c | 5 +++-- arch/m68k/kernel/ptrace.c | 5 +++-- arch/m68knommu/kernel/ptrace.c | 5 +++-- arch/mips/kernel/ptrace.c | 3 ++- arch/mips/kernel/ptrace32.c | 3 ++- arch/parisc/kernel/ptrace.c | 7 ++++--- arch/ppc/kernel/ptrace.c | 5 +++-- arch/ppc64/kernel/ptrace.c | 5 +++-- arch/ppc64/kernel/ptrace32.c | 5 +++-- arch/s390/kernel/ptrace.c | 5 +++-- arch/sh/kernel/ptrace.c | 5 +++-- arch/sh64/kernel/ptrace.c | 5 +++-- arch/sparc/kernel/ptrace.c | 3 ++- arch/sparc64/kernel/ptrace.c | 3 ++- arch/um/kernel/ptrace.c | 4 ++-- arch/v850/kernel/ptrace.c | 3 ++- arch/x86_64/kernel/ptrace.c | 5 +++-- drivers/char/vt_ioctl.c | 3 ++- fs/fcntl.c | 3 ++- ipc/mqueue.c | 4 ++-- kernel/exit.c | 5 +++-- kernel/futex.c | 3 ++- kernel/ptrace.c | 3 ++- kernel/signal.c | 9 +++++---- kernel/sys.c | 3 ++- 33 files changed, 90 insertions(+), 59 deletions(-) (limited to 'arch/um') diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index d00583161574..bbd37536d14e 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -335,7 +336,7 @@ do_sys_ptrace(long request, long pid, long addr, long data, /* continue and stop at next (return from) syscall */ case PTRACE_CONT: /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -365,7 +366,7 @@ do_sys_ptrace(long request, long pid, long addr, long data, case PTRACE_SINGLESTEP: /* execute single instruction. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; /* Mark single stepping. */ child->thread_info->bpt_nsaved = -1; diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index efd7a341614b..cd99b83f14c2 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -693,7 +694,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat case PTRACE_SYSCALL: case PTRACE_CONT: ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -728,7 +729,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat */ case PTRACE_SINGLESTEP: ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; child->ptrace |= PT_SINGLESTEP; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); diff --git a/arch/arm26/kernel/ptrace.c b/arch/arm26/kernel/ptrace.c index 2a137146a77c..8a52124de0e1 100644 --- a/arch/arm26/kernel/ptrace.c +++ b/arch/arm26/kernel/ptrace.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -591,7 +592,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat case PTRACE_SYSCALL: case PTRACE_CONT: ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -626,7 +627,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat */ case PTRACE_SINGLESTEP: ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; child->ptrace |= PT_SINGLESTEP; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c index da15db8ae482..581ecabaae53 100644 --- a/arch/cris/arch-v10/kernel/ptrace.c +++ b/arch/cris/arch-v10/kernel/ptrace.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -184,7 +185,7 @@ sys_ptrace(long request, long pid, long addr, long data) case PTRACE_CONT: ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) { @@ -219,7 +220,7 @@ sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SINGLESTEP: ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); diff --git a/arch/frv/kernel/ptrace.c b/arch/frv/kernel/ptrace.c index 2a0efb739adc..cbe03cba9f02 100644 --- a/arch/frv/kernel/ptrace.c +++ b/arch/frv/kernel/ptrace.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -239,7 +240,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -267,7 +268,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SINGLESTEP: /* set the trap flag. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); ptrace_enable(child); diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c index 5f19d774a288..05c15e869777 100644 --- a/arch/h8300/kernel/ptrace.c +++ b/arch/h8300/kernel/ptrace.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -171,7 +172,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */ ret = -EIO; - if ((unsigned long) data >= _NSIG) + if (!valid_signal(data)) break ; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -202,7 +203,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SINGLESTEP: { /* set the trap flag. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); child->exit_code = data; diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c index b2f17640ceff..e8c965ce86eb 100644 --- a/arch/i386/kernel/ptrace.c +++ b/arch/i386/kernel/ptrace.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -511,7 +512,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) { set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -543,7 +544,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SINGLESTEP: /* set the trap flag. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); set_singlestep(child); diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 55789fcd7210..c253fd5914fc 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -1481,7 +1482,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data) case PTRACE_CONT: /* restart after signal. */ ret = -EIO; - if (data > _NSIG) + if (!valid_signal(data)) goto out_tsk; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -1520,7 +1521,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data) /* let child execute for one instruction */ case PTRACE_SINGLEBLOCK: ret = -EIO; - if (data > _NSIG) + if (!valid_signal(data)) goto out_tsk; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c index 8b40f362dd6f..124f7c1b775e 100644 --- a/arch/m32r/kernel/ptrace.c +++ b/arch/m32r/kernel/ptrace.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -665,7 +666,7 @@ do_ptrace(long request, struct task_struct *child, long addr, long data) case PTRACE_SYSCALL: case PTRACE_CONT: ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -700,7 +701,7 @@ do_ptrace(long request, struct task_struct *child, long addr, long data) unsigned long pc, insn; ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); if ((child->ptrace & PT_DTRACE) == 0) { diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c index 0beb53333ba3..f4e1e5eb8e12 100644 --- a/arch/m68k/kernel/ptrace.c +++ b/arch/m68k/kernel/ptrace.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -251,7 +252,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) long tmp; ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) { child->thread.work.syscall_trace = ~0; @@ -292,7 +293,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) long tmp; ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; child->thread.work.syscall_trace = 0; tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16); diff --git a/arch/m68knommu/kernel/ptrace.c b/arch/m68knommu/kernel/ptrace.c index 15cf79080b15..9724e1cd82e5 100644 --- a/arch/m68knommu/kernel/ptrace.c +++ b/arch/m68knommu/kernel/ptrace.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -240,7 +241,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) long tmp; ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -278,7 +279,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) long tmp; ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16); diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 92f2c39afe27..a2f899c2f4d4 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -257,7 +258,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) { set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c index 611dee919d50..eee207969c21 100644 --- a/arch/mips/kernel/ptrace32.c +++ b/arch/mips/kernel/ptrace32.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -241,7 +242,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */ ret = -EIO; - if ((unsigned int) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) { set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 2937a9236384..c07db9dff7cd 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -285,7 +286,7 @@ long sys_ptrace(long request, pid_t pid, long addr, long data) ret = -EIO; DBG("sys_ptrace(%s)\n", request == PTRACE_SYSCALL ? "SYSCALL" : "CONT"); - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) goto out_tsk; child->ptrace &= ~(PT_SINGLESTEP|PT_BLOCKSTEP); if (request == PTRACE_SYSCALL) { @@ -311,7 +312,7 @@ long sys_ptrace(long request, pid_t pid, long addr, long data) case PTRACE_SINGLEBLOCK: DBG("sys_ptrace(SINGLEBLOCK)\n"); ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) goto out_tsk; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); child->ptrace &= ~PT_SINGLESTEP; @@ -328,7 +329,7 @@ long sys_ptrace(long request, pid_t pid, long addr, long data) case PTRACE_SINGLESTEP: DBG("sys_ptrace(SINGLESTEP)\n"); ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) goto out_tsk; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); diff --git a/arch/ppc/kernel/ptrace.c b/arch/ppc/kernel/ptrace.c index 426b6f7d9de3..59d59a8dc249 100644 --- a/arch/ppc/kernel/ptrace.c +++ b/arch/ppc/kernel/ptrace.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -356,7 +357,7 @@ int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) { set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -389,7 +390,7 @@ int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SINGLESTEP: { /* set the trap flag. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); set_single_step(child); diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c index 354a287c67eb..5a846324ca8c 100644 --- a/arch/ppc64/kernel/ptrace.c +++ b/arch/ppc64/kernel/ptrace.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -162,7 +163,7 @@ int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -194,7 +195,7 @@ int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SINGLESTEP: { /* set the trap flag. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); set_single_step(child); diff --git a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c index ee81b1b776cc..16436426c7e2 100644 --- a/arch/ppc64/kernel/ptrace32.c +++ b/arch/ppc64/kernel/ptrace32.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -293,7 +294,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -325,7 +326,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) case PTRACE_SINGLESTEP: { /* set the trap flag. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); set_single_step(child); diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 647233c02fc8..9f0d73e3f5f7 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -609,7 +610,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data) /* continue and stop at next (return from) syscall */ case PTRACE_CONT: /* restart after signal. */ - if ((unsigned long) data >= _NSIG) + if (!valid_signal(data)) return -EIO; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -637,7 +638,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data) case PTRACE_SINGLESTEP: /* set the trap flag. */ - if ((unsigned long) data >= _NSIG) + if (!valid_signal(data)) return -EIO; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); child->exit_code = data; diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c index 1b0dfb4d8ea4..b28919b65682 100644 --- a/arch/sh/kernel/ptrace.c +++ b/arch/sh/kernel/ptrace.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -197,7 +198,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -228,7 +229,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) struct pt_regs *dummy = NULL; ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); if ((child->ptrace & PT_DTRACE) == 0) { diff --git a/arch/sh64/kernel/ptrace.c b/arch/sh64/kernel/ptrace.c index 800288c1562b..fd2000956dae 100644 --- a/arch/sh64/kernel/ptrace.c +++ b/arch/sh64/kernel/ptrace.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -255,7 +256,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); @@ -285,7 +286,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) struct pt_regs *regs; ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); if ((child->ptrace & PT_DTRACE) == 0) { diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c index c4f93bd2daf2..475c4c13462c 100644 --- a/arch/sparc/kernel/ptrace.c +++ b/arch/sparc/kernel/ptrace.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -526,7 +527,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) addr = 1; case PTRACE_CONT: { /* restart after signal. */ - if (data > _NSIG) { + if (!valid_signal(data)) { pt_error_return(regs, EIO); goto out_tsk; } diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index 5f080cf04b33..80a76e2ad732 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -559,7 +560,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) addr = 1; case PTRACE_CONT: { /* restart after signal. */ - if (data > _NSIG) { + if (!valid_signal(data)) { pt_error_return(regs, EIO); goto out_tsk; } diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 3a99ee6d94eb..e50e60ff5d27 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c @@ -143,7 +143,7 @@ long sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; child->ptrace &= ~PT_DTRACE; @@ -179,7 +179,7 @@ long sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SINGLESTEP: { /* set the trap flag. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); child->ptrace |= PT_DTRACE; diff --git a/arch/v850/kernel/ptrace.c b/arch/v850/kernel/ptrace.c index 8fa780757dcd..4726b87f5e5a 100644 --- a/arch/v850/kernel/ptrace.c +++ b/arch/v850/kernel/ptrace.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -208,7 +209,7 @@ int sys_ptrace(long request, long pid, long addr, long data) /* Execute a single instruction. */ case PTRACE_SINGLESTEP: rval = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; /* Turn CHILD's single-step flag on or off. */ diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c index c7011675007d..c64b9c97c745 100644 --- a/arch/x86_64/kernel/ptrace.c +++ b/arch/x86_64/kernel/ptrace.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -467,7 +468,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data case PTRACE_CONT: /* restart after signal. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; if (request == PTRACE_SYSCALL) set_tsk_thread_flag(child,TIF_SYSCALL_TRACE); @@ -529,7 +530,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data case PTRACE_SINGLESTEP: /* set the trap flag. */ ret = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE); set_singlestep(child); diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 5d386f4bea49..8971484b956b 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -641,7 +642,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, extern int spawnpid, spawnsig; if (!perm || !capable(CAP_KILL)) return -EPERM; - if (arg < 1 || arg > _NSIG || arg == SIGKILL) + if (!valid_signal(arg) || arg < 1 || arg == SIGKILL) return -EINVAL; spawnpid = current->pid; spawnsig = arg; diff --git a/fs/fcntl.c b/fs/fcntl.c index 3e7ab16ed154..286a9f8f3d49 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -308,7 +309,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg, break; case F_SETSIG: /* arg == 0 restores default behaviour. */ - if (arg < 0 || arg > _NSIG) { + if (!valid_signal(arg)) { break; } err = 0; diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 33f71520b89c..0acf245f441d 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "util.h" @@ -976,8 +977,7 @@ asmlinkage long sys_mq_notify(mqd_t mqdes, notification.sigev_notify != SIGEV_THREAD)) return -EINVAL; if (notification.sigev_notify == SIGEV_SIGNAL && - (notification.sigev_signo < 0 || - notification.sigev_signo > _NSIG)) { + !valid_signal(notification.sigev_signo)) { return -EINVAL; } if (notification.sigev_notify == SIGEV_THREAD) { diff --git a/kernel/exit.c b/kernel/exit.c index 93851bcd9584..eb8da36e13df 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -277,7 +278,7 @@ void set_special_pids(pid_t session, pid_t pgrp) */ int allow_signal(int sig) { - if (sig < 1 || sig > _NSIG) + if (!valid_signal(sig) || sig < 1) return -EINVAL; spin_lock_irq(¤t->sighand->siglock); @@ -298,7 +299,7 @@ EXPORT_SYMBOL(allow_signal); int disallow_signal(int sig) { - if (sig < 1 || sig > _NSIG) + if (!valid_signal(sig) || sig < 1) return -EINVAL; spin_lock_irq(¤t->sighand->siglock); diff --git a/kernel/futex.c b/kernel/futex.c index 7b54a672d0ad..c7130f86106c 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -39,6 +39,7 @@ #include #include #include +#include #define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8) @@ -654,7 +655,7 @@ static int futex_fd(unsigned long uaddr, int signal) int ret, err; ret = -EINVAL; - if (signal < 0 || signal > _NSIG) + if (!valid_signal(signal)) goto out; ret = get_unused_fd(); diff --git a/kernel/ptrace.c b/kernel/ptrace.c index f5cc1cec0fb4..8dcb8f6288bc 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -166,7 +167,7 @@ bad: int ptrace_detach(struct task_struct *child, unsigned int data) { - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) return -EIO; /* Architecture-specific hardware disable .. */ diff --git a/kernel/signal.c b/kernel/signal.c index e6567d7f2b62..8f3debc77c5b 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -646,7 +647,7 @@ static int check_kill_permission(int sig, struct siginfo *info, struct task_struct *t) { int error = -EINVAL; - if (sig < 0 || sig > _NSIG) + if (!valid_signal(sig)) return error; error = -EPERM; if ((!info || ((unsigned long)info != 1 && @@ -1245,7 +1246,7 @@ send_sig_info(int sig, struct siginfo *info, struct task_struct *p) * Make sure legacy kernel users don't send in bad values * (normal paths check this in check_kill_permission). */ - if (sig < 0 || sig > _NSIG) + if (!valid_signal(sig)) return -EINVAL; /* @@ -1520,7 +1521,7 @@ void do_notify_parent(struct task_struct *tsk, int sig) if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) sig = 0; } - if (sig > 0 && sig <= _NSIG) + if (valid_signal(sig) && sig > 0) __group_send_sig_info(sig, &info, tsk->parent); __wake_up_parent(tsk, tsk->parent); spin_unlock_irqrestore(&psig->siglock, flags); @@ -2364,7 +2365,7 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact) { struct k_sigaction *k; - if (sig < 1 || sig > _NSIG || (act && sig_kernel_only(sig))) + if (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig))) return -EINVAL; k = ¤t->sighand->action[sig-1]; diff --git a/kernel/sys.c b/kernel/sys.c index 7f43d6e62c7a..f64e97cabe25 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1637,7 +1638,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, switch (option) { case PR_SET_PDEATHSIG: sig = arg2; - if (sig < 0 || sig > _NSIG) { + if (!valid_signal(sig)) { error = -EINVAL; break; } -- cgit v1.2.3-59-g8ed1b