Commit 6ff84735 authored by Deepa Dinamani's avatar Deepa Dinamani Committed by Thomas Gleixner

time: Change types to new y2038 safe __kernel_itimerspec

timer_set/gettime and timerfd_set/get apis use struct itimerspec at the
user interface layer.  struct itimerspec is not y2038-safe.  Change these
interfaces to use y2038-safe struct __kernel_itimerspec instead.  This will
help define new syscalls when 32bit architectures select CONFIG_64BIT_TIME.
Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: arnd@arndb.de
Cc: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-api@vger.kernel.org
Cc: y2038@lists.linaro.org
Link: https://lkml.kernel.org/r/20180617051144.29756-4-deepa.kernel@gmail.com
parent afef05cf
...@@ -533,8 +533,8 @@ static int do_timerfd_gettime(int ufd, struct itimerspec64 *t) ...@@ -533,8 +533,8 @@ static int do_timerfd_gettime(int ufd, struct itimerspec64 *t)
} }
SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
const struct itimerspec __user *, utmr, const struct __kernel_itimerspec __user *, utmr,
struct itimerspec __user *, otmr) struct __kernel_itimerspec __user *, otmr)
{ {
struct itimerspec64 new, old; struct itimerspec64 new, old;
int ret; int ret;
...@@ -550,7 +550,7 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, ...@@ -550,7 +550,7 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
return ret; return ret;
} }
SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr) SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct __kernel_itimerspec __user *, otmr)
{ {
struct itimerspec64 kotmr; struct itimerspec64 kotmr;
int ret = do_timerfd_gettime(ufd, &kotmr); int ret = do_timerfd_gettime(ufd, &kotmr);
...@@ -559,7 +559,7 @@ SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr) ...@@ -559,7 +559,7 @@ SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
return put_itimerspec64(&kotmr, otmr) ? -EFAULT : 0; return put_itimerspec64(&kotmr, otmr) ? -EFAULT : 0;
} }
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT_32BIT_TIME
COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
const struct compat_itimerspec __user *, utmr, const struct compat_itimerspec __user *, utmr,
struct compat_itimerspec __user *, otmr) struct compat_itimerspec __user *, otmr)
......
...@@ -501,9 +501,9 @@ asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, ...@@ -501,9 +501,9 @@ asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
/* fs/timerfd.c */ /* fs/timerfd.c */
asmlinkage long sys_timerfd_create(int clockid, int flags); asmlinkage long sys_timerfd_create(int clockid, int flags);
asmlinkage long sys_timerfd_settime(int ufd, int flags, asmlinkage long sys_timerfd_settime(int ufd, int flags,
const struct itimerspec __user *utmr, const struct __kernel_itimerspec __user *utmr,
struct itimerspec __user *otmr); struct __kernel_itimerspec __user *otmr);
asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); asmlinkage long sys_timerfd_gettime(int ufd, struct __kernel_itimerspec __user *otmr);
/* fs/utimes.c */ /* fs/utimes.c */
asmlinkage long sys_utimensat(int dfd, const char __user *filename, asmlinkage long sys_utimensat(int dfd, const char __user *filename,
...@@ -568,10 +568,10 @@ asmlinkage long sys_timer_create(clockid_t which_clock, ...@@ -568,10 +568,10 @@ asmlinkage long sys_timer_create(clockid_t which_clock,
struct sigevent __user *timer_event_spec, struct sigevent __user *timer_event_spec,
timer_t __user * created_timer_id); timer_t __user * created_timer_id);
asmlinkage long sys_timer_gettime(timer_t timer_id, asmlinkage long sys_timer_gettime(timer_t timer_id,
struct itimerspec __user *setting); struct __kernel_itimerspec __user *setting);
asmlinkage long sys_timer_getoverrun(timer_t timer_id); asmlinkage long sys_timer_getoverrun(timer_t timer_id);
asmlinkage long sys_timer_settime(timer_t timer_id, int flags, asmlinkage long sys_timer_settime(timer_t timer_id, int flags,
const struct itimerspec __user *new_setting, const struct __kernel_itimerspec __user *new_setting,
struct itimerspec __user *old_setting); struct itimerspec __user *old_setting);
asmlinkage long sys_timer_delete(timer_t timer_id); asmlinkage long sys_timer_delete(timer_t timer_id);
asmlinkage long sys_clock_settime(clockid_t which_clock, asmlinkage long sys_clock_settime(clockid_t which_clock,
......
...@@ -743,7 +743,7 @@ static int do_timer_gettime(timer_t timer_id, struct itimerspec64 *setting) ...@@ -743,7 +743,7 @@ static int do_timer_gettime(timer_t timer_id, struct itimerspec64 *setting)
/* Get the time remaining on a POSIX.1b interval timer. */ /* Get the time remaining on a POSIX.1b interval timer. */
SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
struct itimerspec __user *, setting) struct __kernel_itimerspec __user *, setting)
{ {
struct itimerspec64 cur_setting; struct itimerspec64 cur_setting;
...@@ -755,7 +755,8 @@ SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, ...@@ -755,7 +755,8 @@ SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
return ret; return ret;
} }
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT_32BIT_TIME
COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
struct compat_itimerspec __user *, setting) struct compat_itimerspec __user *, setting)
{ {
...@@ -768,6 +769,7 @@ COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, ...@@ -768,6 +769,7 @@ COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
} }
return ret; return ret;
} }
#endif #endif
/* /*
...@@ -906,8 +908,8 @@ static int do_timer_settime(timer_t timer_id, int flags, ...@@ -906,8 +908,8 @@ static int do_timer_settime(timer_t timer_id, int flags,
/* Set a POSIX.1b interval timer */ /* Set a POSIX.1b interval timer */
SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
const struct itimerspec __user *, new_setting, const struct __kernel_itimerspec __user *, new_setting,
struct itimerspec __user *, old_setting) struct __kernel_itimerspec __user *, old_setting)
{ {
struct itimerspec64 new_spec, old_spec; struct itimerspec64 new_spec, old_spec;
struct itimerspec64 *rtn = old_setting ? &old_spec : NULL; struct itimerspec64 *rtn = old_setting ? &old_spec : NULL;
...@@ -927,7 +929,7 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, ...@@ -927,7 +929,7 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
return error; return error;
} }
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT_32BIT_TIME
COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
struct compat_itimerspec __user *, new, struct compat_itimerspec __user *, new,
struct compat_itimerspec __user *, old) struct compat_itimerspec __user *, old)
......
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