Commit 3876ced4 authored by Deepa Dinamani's avatar Deepa Dinamani Committed by Arnd Bergmann

timex: change syscalls to use struct __kernel_timex

struct timex is not y2038 safe.
Switch all the syscall apis to use y2038 safe __kernel_timex.

Note that sys_adjtimex() does not have a y2038 safe solution.  C libraries
can implement it by calling clock_adjtime(CLOCK_REALTIME, ...).
Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent ead25417
...@@ -54,7 +54,7 @@ struct __sysctl_args; ...@@ -54,7 +54,7 @@ struct __sysctl_args;
struct sysinfo; struct sysinfo;
struct timespec; struct timespec;
struct timeval; struct timeval;
struct timex; struct __kernel_timex;
struct timezone; struct timezone;
struct tms; struct tms;
struct utimbuf; struct utimbuf;
...@@ -695,7 +695,7 @@ asmlinkage long sys_gettimeofday(struct timeval __user *tv, ...@@ -695,7 +695,7 @@ asmlinkage long sys_gettimeofday(struct timeval __user *tv,
struct timezone __user *tz); struct timezone __user *tz);
asmlinkage long sys_settimeofday(struct timeval __user *tv, asmlinkage long sys_settimeofday(struct timeval __user *tv,
struct timezone __user *tz); struct timezone __user *tz);
asmlinkage long sys_adjtimex(struct timex __user *txc_p); asmlinkage long sys_adjtimex(struct __kernel_timex __user *txc_p);
/* kernel/timer.c */ /* kernel/timer.c */
asmlinkage long sys_getpid(void); asmlinkage long sys_getpid(void);
...@@ -870,7 +870,7 @@ asmlinkage long sys_open_by_handle_at(int mountdirfd, ...@@ -870,7 +870,7 @@ asmlinkage long sys_open_by_handle_at(int mountdirfd,
struct file_handle __user *handle, struct file_handle __user *handle,
int flags); int flags);
asmlinkage long sys_clock_adjtime(clockid_t which_clock, asmlinkage long sys_clock_adjtime(clockid_t which_clock,
struct timex __user *tx); struct __kernel_timex __user *tx);
asmlinkage long sys_syncfs(int fd); asmlinkage long sys_syncfs(int fd);
asmlinkage long sys_setns(int fd, int nstype); asmlinkage long sys_setns(int fd, int nstype);
asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg, asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
......
...@@ -1060,7 +1060,7 @@ int do_clock_adjtime(const clockid_t which_clock, struct __kernel_timex * ktx) ...@@ -1060,7 +1060,7 @@ int do_clock_adjtime(const clockid_t which_clock, struct __kernel_timex * ktx)
} }
SYSCALL_DEFINE2(clock_adjtime, const clockid_t, which_clock, SYSCALL_DEFINE2(clock_adjtime, const clockid_t, which_clock,
struct timex __user *, utx) struct __kernel_timex __user *, utx)
{ {
struct __kernel_timex ktx; struct __kernel_timex ktx;
int err; int err;
......
...@@ -263,7 +263,8 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv, ...@@ -263,7 +263,8 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv,
} }
#endif #endif
SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p) #if !defined(CONFIG_64BIT_TIME) || defined(CONFIG_64BIT)
SYSCALL_DEFINE1(adjtimex, struct __kernel_timex __user *, txc_p)
{ {
struct __kernel_timex txc; /* Local copy of parameter */ struct __kernel_timex txc; /* Local copy of parameter */
int ret; int ret;
...@@ -277,6 +278,7 @@ SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p) ...@@ -277,6 +278,7 @@ SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
ret = do_adjtimex(&txc); ret = do_adjtimex(&txc);
return copy_to_user(txc_p, &txc, sizeof(struct __kernel_timex)) ? -EFAULT : ret; return copy_to_user(txc_p, &txc, sizeof(struct __kernel_timex)) ? -EFAULT : ret;
} }
#endif
#ifdef CONFIG_COMPAT_32BIT_TIME #ifdef CONFIG_COMPAT_32BIT_TIME
int get_old_timex32(struct __kernel_timex *txc, const struct old_timex32 __user *utp) int get_old_timex32(struct __kernel_timex *txc, const struct old_timex32 __user *utp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment