Commit 75d319c0 authored by Arnd Bergmann's avatar Arnd Bergmann

y2038: syscalls: change remaining timeval to __kernel_old_timeval

All of the remaining syscalls that pass a timeval (gettimeofday, utime,
futimesat) can trivially be changed to pass a __kernel_old_timeval
instead, which has a compatible layout, but avoids ambiguity with
the timeval type in user space.
Acked-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent bdd565f8
...@@ -92,7 +92,8 @@ long sys_swapcontext(struct ucontext __user *old_ctx, ...@@ -92,7 +92,8 @@ long sys_swapcontext(struct ucontext __user *old_ctx,
long sys_debug_setcontext(struct ucontext __user *ctx, long sys_debug_setcontext(struct ucontext __user *ctx,
int ndbg, struct sig_dbg_op __user *dbg); int ndbg, struct sig_dbg_op __user *dbg);
int int
ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp); ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
struct __kernel_old_timeval __user *tvp);
unsigned long __init early_init(unsigned long dt_ptr); unsigned long __init early_init(unsigned long dt_ptr);
void __init machine_init(u64 dt_ptr); void __init machine_init(u64 dt_ptr);
#endif #endif
......
...@@ -79,7 +79,7 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len, ...@@ -79,7 +79,7 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
* sys_select() with the appropriate args. -- Cort * sys_select() with the appropriate args. -- Cort
*/ */
int int
ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp) ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct __kernel_old_timeval __user *tvp)
{ {
if ( (unsigned long)n >= 4096 ) if ( (unsigned long)n >= 4096 )
{ {
...@@ -89,7 +89,7 @@ ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, s ...@@ -89,7 +89,7 @@ ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, s
|| __get_user(inp, ((fd_set __user * __user *)(buffer+1))) || __get_user(inp, ((fd_set __user * __user *)(buffer+1)))
|| __get_user(outp, ((fd_set __user * __user *)(buffer+2))) || __get_user(outp, ((fd_set __user * __user *)(buffer+2)))
|| __get_user(exp, ((fd_set __user * __user *)(buffer+3))) || __get_user(exp, ((fd_set __user * __user *)(buffer+3)))
|| __get_user(tvp, ((struct timeval __user * __user *)(buffer+4)))) || __get_user(tvp, ((struct __kernel_old_timeval __user * __user *)(buffer+4))))
return -EFAULT; return -EFAULT;
} }
return sys_select(n, inp, outp, exp, tvp); return sys_select(n, inp, outp, exp, tvp);
......
...@@ -321,7 +321,7 @@ static int poll_select_finish(struct timespec64 *end_time, ...@@ -321,7 +321,7 @@ static int poll_select_finish(struct timespec64 *end_time,
switch (pt_type) { switch (pt_type) {
case PT_TIMEVAL: case PT_TIMEVAL:
{ {
struct timeval rtv; struct __kernel_old_timeval rtv;
if (sizeof(rtv) > sizeof(rtv.tv_sec) + sizeof(rtv.tv_usec)) if (sizeof(rtv) > sizeof(rtv.tv_sec) + sizeof(rtv.tv_usec))
memset(&rtv, 0, sizeof(rtv)); memset(&rtv, 0, sizeof(rtv));
...@@ -698,10 +698,10 @@ int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, ...@@ -698,10 +698,10 @@ int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
} }
static int kern_select(int n, fd_set __user *inp, fd_set __user *outp, static int kern_select(int n, fd_set __user *inp, fd_set __user *outp,
fd_set __user *exp, struct timeval __user *tvp) fd_set __user *exp, struct __kernel_old_timeval __user *tvp)
{ {
struct timespec64 end_time, *to = NULL; struct timespec64 end_time, *to = NULL;
struct timeval tv; struct __kernel_old_timeval tv;
int ret; int ret;
if (tvp) { if (tvp) {
...@@ -720,7 +720,7 @@ static int kern_select(int n, fd_set __user *inp, fd_set __user *outp, ...@@ -720,7 +720,7 @@ static int kern_select(int n, fd_set __user *inp, fd_set __user *outp,
} }
SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp, SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp,
fd_set __user *, exp, struct timeval __user *, tvp) fd_set __user *, exp, struct __kernel_old_timeval __user *, tvp)
{ {
return kern_select(n, inp, outp, exp, tvp); return kern_select(n, inp, outp, exp, tvp);
} }
...@@ -810,7 +810,7 @@ SYSCALL_DEFINE6(pselect6_time32, int, n, fd_set __user *, inp, fd_set __user *, ...@@ -810,7 +810,7 @@ SYSCALL_DEFINE6(pselect6_time32, int, n, fd_set __user *, inp, fd_set __user *,
struct sel_arg_struct { struct sel_arg_struct {
unsigned long n; unsigned long n;
fd_set __user *inp, *outp, *exp; fd_set __user *inp, *outp, *exp;
struct timeval __user *tvp; struct __kernel_old_timeval __user *tvp;
}; };
SYSCALL_DEFINE1(old_select, struct sel_arg_struct __user *, arg) SYSCALL_DEFINE1(old_select, struct sel_arg_struct __user *, arg)
......
...@@ -161,9 +161,9 @@ SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename, ...@@ -161,9 +161,9 @@ SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename,
* utimensat() instead. * utimensat() instead.
*/ */
static long do_futimesat(int dfd, const char __user *filename, static long do_futimesat(int dfd, const char __user *filename,
struct timeval __user *utimes) struct __kernel_old_timeval __user *utimes)
{ {
struct timeval times[2]; struct __kernel_old_timeval times[2];
struct timespec64 tstimes[2]; struct timespec64 tstimes[2];
if (utimes) { if (utimes) {
...@@ -190,13 +190,13 @@ static long do_futimesat(int dfd, const char __user *filename, ...@@ -190,13 +190,13 @@ static long do_futimesat(int dfd, const char __user *filename,
SYSCALL_DEFINE3(futimesat, int, dfd, const char __user *, filename, SYSCALL_DEFINE3(futimesat, int, dfd, const char __user *, filename,
struct timeval __user *, utimes) struct __kernel_old_timeval __user *, utimes)
{ {
return do_futimesat(dfd, filename, utimes); return do_futimesat(dfd, filename, utimes);
} }
SYSCALL_DEFINE2(utimes, char __user *, filename, SYSCALL_DEFINE2(utimes, char __user *, filename,
struct timeval __user *, utimes) struct __kernel_old_timeval __user *, utimes)
{ {
return do_futimesat(AT_FDCWD, filename, utimes); return do_futimesat(AT_FDCWD, filename, utimes);
} }
......
...@@ -51,7 +51,7 @@ struct statx; ...@@ -51,7 +51,7 @@ struct statx;
struct __sysctl_args; struct __sysctl_args;
struct sysinfo; struct sysinfo;
struct timespec; struct timespec;
struct timeval; struct __kernel_old_timeval;
struct __kernel_timex; struct __kernel_timex;
struct timezone; struct timezone;
struct tms; struct tms;
...@@ -732,7 +732,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, ...@@ -732,7 +732,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
/* kernel/time.c */ /* kernel/time.c */
asmlinkage long sys_gettimeofday(struct timeval __user *tv, asmlinkage long sys_gettimeofday(struct __kernel_old_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);
...@@ -1082,9 +1082,9 @@ asmlinkage long sys_time32(old_time32_t __user *tloc); ...@@ -1082,9 +1082,9 @@ asmlinkage long sys_time32(old_time32_t __user *tloc);
asmlinkage long sys_utime(char __user *filename, asmlinkage long sys_utime(char __user *filename,
struct utimbuf __user *times); struct utimbuf __user *times);
asmlinkage long sys_utimes(char __user *filename, asmlinkage long sys_utimes(char __user *filename,
struct timeval __user *utimes); struct __kernel_old_timeval __user *utimes);
asmlinkage long sys_futimesat(int dfd, const char __user *filename, asmlinkage long sys_futimesat(int dfd, const char __user *filename,
struct timeval __user *utimes); struct __kernel_old_timeval __user *utimes);
#endif #endif
asmlinkage long sys_futimesat_time32(unsigned int dfd, asmlinkage long sys_futimesat_time32(unsigned int dfd,
const char __user *filename, const char __user *filename,
...@@ -1098,7 +1098,7 @@ asmlinkage long sys_getdents(unsigned int fd, ...@@ -1098,7 +1098,7 @@ asmlinkage long sys_getdents(unsigned int fd,
struct linux_dirent __user *dirent, struct linux_dirent __user *dirent,
unsigned int count); unsigned int count);
asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
fd_set __user *exp, struct timeval __user *tvp); fd_set __user *exp, struct __kernel_old_timeval __user *tvp);
asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
int timeout); int timeout);
asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
......
...@@ -179,7 +179,7 @@ extern void swsusp_close(fmode_t); ...@@ -179,7 +179,7 @@ extern void swsusp_close(fmode_t);
extern int swsusp_unmark(void); extern int swsusp_unmark(void);
#endif #endif
struct timeval; struct __kernel_old_timeval;
/* kernel/power/swsusp.c */ /* kernel/power/swsusp.c */
extern void swsusp_show_speed(ktime_t, ktime_t, unsigned int, char *); extern void swsusp_show_speed(ktime_t, ktime_t, unsigned int, char *);
......
...@@ -137,7 +137,7 @@ SYSCALL_DEFINE1(stime32, old_time32_t __user *, tptr) ...@@ -137,7 +137,7 @@ SYSCALL_DEFINE1(stime32, old_time32_t __user *, tptr)
#endif /* __ARCH_WANT_SYS_TIME32 */ #endif /* __ARCH_WANT_SYS_TIME32 */
#endif #endif
SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv, SYSCALL_DEFINE2(gettimeofday, struct __kernel_old_timeval __user *, tv,
struct timezone __user *, tz) struct timezone __user *, tz)
{ {
if (likely(tv != NULL)) { if (likely(tv != NULL)) {
......
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