From 8fa29920db547f6d0e7729533be5ccf0a005b89b Mon Sep 17 00:00:00 2001 From: Martin Schwidefsky Date: Tue, 4 Jan 2005 05:29:47 -0800 Subject: [PATCH] sys_stime needs a compat function I realized that the best way to get the sys_time/sys_stime problem fixed is to make sys_time 64 bit safe by using "time_t *" instead of "int *" and to introduce two proper compat functions compat_sys_time and compat_sys_stime. The prototype change of sys_time is transparent for 32 bit architectures because both "int" and "time_t" are 32 bit. For 64 bit the type change would be wrong but luckily no 64 bit architecture uses sys_time/sys_stime in 64 bit mode. The patch makes the following change: ia64 : Remove sys32_time, use compat_sys_time and add (!!) compat_sys_stime to compat syscall table. mips : Use compat_sys_time/compat_sys_stime in 32 bit syscall table. Add #ifdef magic to compile sys_time/sys_stime and compat_sys_time/compat_sys_stime only if needed. parisc : Remove sys32_time, use compat_sys_time and compat_sys_stime. ppc64 : remove sys32_time, ppc64_sys32_stime and ppc64_sys_stime. Use common compat_sys_time, compat_sys_stime and sys_stime. s390 : Use compat_sys_stime. Add #ifdef magic to compile sys_time/sys_stime and compat_sys_time/compat_sys_stime only if needed. sparc64 : Use compat_sys_time/compat_Sys_stime in 32 bit syscall table. um : Remove um_time and um_stime. Use common functions sys_time and sys_stime. This adds a CAP_SYS_TIME check to UMs stime call. x86_64 : Remove sys32_time. Use compat_sys_time and compat_sys_stime in 32 bit syscall table. The original stime bug is fixed for mips, parisc, s390, sparc64 and x86_64. Can the arch-maintainers please take a look at this? From: Martin Schwidefsky Convert compat_time_t to time_t in 32 bit emulation for sys_stime and consolidate all the different implementation of sys_time, sys_stime and their 32-bit emulation parts. Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-ia64/unistd.h | 1 + include/asm-mips/unistd.h | 7 ++++++- include/asm-parisc/unistd.h | 1 + include/asm-ppc64/unistd.h | 1 + include/asm-s390/unistd.h | 5 +++-- include/asm-sparc64/unistd.h | 1 + include/asm-x86_64/unistd.h | 2 +- include/linux/syscalls.h | 2 +- 8 files changed, 15 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index 99cc90c11850..85066563712f 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h @@ -281,6 +281,7 @@ # define __ARCH_WANT_SYS_OLDUMOUNT # define __ARCH_WANT_SYS_SIGPENDING # define __ARCH_WANT_SYS_SIGPROCMASK +# define __ARCH_WANT_COMPAT_SYS_TIME #endif #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER) diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h index 4b0c21047839..b0b67dbeada6 100644 --- a/include/asm-mips/unistd.h +++ b/include/asm-mips/unistd.h @@ -1106,7 +1106,6 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \ #define __ARCH_WANT_SYS_GETHOSTNAME #define __ARCH_WANT_SYS_PAUSE #define __ARCH_WANT_SYS_SGETMASK -#define __ARCH_WANT_SYS_TIME #define __ARCH_WANT_SYS_UTIME #define __ARCH_WANT_SYS_WAITPID #define __ARCH_WANT_SYS_SOCKETCALL @@ -1122,6 +1121,12 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \ # ifndef __mips64 # define __ARCH_WANT_STAT64 # endif +# ifdef CONFIG_MIPS32 +# define __ARCH_WANT_SYS_TIME +# endif +# ifdef CONFIG_MIPS32_O32 +# define __ARCH_WANT_COMPAT_SYS_TIME +# endif #endif #ifdef __KERNEL_SYSCALLS__ diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h index 1b4cca464b71..d5598abaf80e 100644 --- a/include/asm-parisc/unistd.h +++ b/include/asm-parisc/unistd.h @@ -912,6 +912,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ #define __ARCH_WANT_SYS_SGETMASK #define __ARCH_WANT_SYS_SIGNAL #define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_COMPAT_SYS_TIME #define __ARCH_WANT_SYS_UTIME #define __ARCH_WANT_SYS_WAITPID #define __ARCH_WANT_SYS_SOCKETCALL diff --git a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h index 1882dfee1d59..d20b4a304838 100644 --- a/include/asm-ppc64/unistd.h +++ b/include/asm-ppc64/unistd.h @@ -431,6 +431,7 @@ static inline _syscall3(int, execve, __const__ char *, file, char **, argv, #define __ARCH_WANT_SYS_SGETMASK #define __ARCH_WANT_SYS_SIGNAL #define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_COMPAT_SYS_TIME #define __ARCH_WANT_SYS_UTIME #define __ARCH_WANT_SYS_WAITPID #define __ARCH_WANT_SYS_SOCKETCALL diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index 78a2b979469a..ad3063446a64 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h @@ -520,7 +520,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ #define __ARCH_WANT_SYS_GETHOSTNAME #define __ARCH_WANT_SYS_PAUSE #define __ARCH_WANT_SYS_SIGNAL -#define __ARCH_WANT_SYS_TIME #define __ARCH_WANT_SYS_UTIME #define __ARCH_WANT_SYS_SOCKETCALL #define __ARCH_WANT_SYS_FADVISE64 @@ -532,9 +531,11 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ #define __ARCH_WANT_SYS_SIGPENDING #define __ARCH_WANT_SYS_SIGPROCMASK #define __ARCH_WANT_SYS_RT_SIGACTION -# ifndef CONFIG_ARCH_S390X +# ifdef CONFIG_ARCH_S390_31 # define __ARCH_WANT_STAT64 +# define __ARCH_WANT_SYS_TIME # endif +# define __ARCH_WANT_COMPAT_SYS_TIME #endif #ifdef __KERNEL_SYSCALLS__ diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h index ce6496c3f888..12c151e1ff69 100644 --- a/include/asm-sparc64/unistd.h +++ b/include/asm-sparc64/unistd.h @@ -489,6 +489,7 @@ asmlinkage long sys_rt_sigaction(int sig, #define __ARCH_WANT_SYS_SGETMASK #define __ARCH_WANT_SYS_SIGNAL #define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_COMPAT_SYS_TIME #define __ARCH_WANT_SYS_UTIME #define __ARCH_WANT_SYS_WAITPID #define __ARCH_WANT_SYS_SOCKETCALL diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 4aa63a1e34a4..506ec8d12e75 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h @@ -581,7 +581,6 @@ do { \ #define __ARCH_WANT_SYS_PAUSE #define __ARCH_WANT_SYS_SGETMASK #define __ARCH_WANT_SYS_SIGNAL -#define __ARCH_WANT_SYS_TIME #define __ARCH_WANT_SYS_UTIME #define __ARCH_WANT_SYS_WAITPID #define __ARCH_WANT_SYS_SOCKETCALL @@ -594,6 +593,7 @@ do { \ #define __ARCH_WANT_SYS_SIGPENDING #define __ARCH_WANT_SYS_SIGPROCMASK #define __ARCH_WANT_SYS_RT_SIGACTION +#define __ARCH_WANT_COMPAT_SYS_TIME #endif #ifndef __KERNEL_SYSCALLS__ diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 06a76c25f096..757cd9be7743 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -63,7 +63,7 @@ struct mq_attr; #include #include -asmlinkage long sys_time(int __user *tloc); +asmlinkage long sys_time(time_t __user *tloc); asmlinkage long sys_stime(time_t __user *tptr); asmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __user *tz); -- cgit v1.2.3