]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/compat.c
Merge tag 'media/v4.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[karo-tx-linux.git] / kernel / compat.c
index 933bcb31ae10d4c1dcaf2c9b5f48861080d9b3df..0621c8e1ab7273fb33eee4812c58bf4c9b07f2d6 100644 (file)
 
 #include <linux/uaccess.h>
 
-static int compat_get_timex(struct timex *txc, struct compat_timex __user *utp)
+int compat_get_timex(struct timex *txc, const struct compat_timex __user *utp)
 {
-       memset(txc, 0, sizeof(struct timex));
-
-       if (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) ||
-                       __get_user(txc->modes, &utp->modes) ||
-                       __get_user(txc->offset, &utp->offset) ||
-                       __get_user(txc->freq, &utp->freq) ||
-                       __get_user(txc->maxerror, &utp->maxerror) ||
-                       __get_user(txc->esterror, &utp->esterror) ||
-                       __get_user(txc->status, &utp->status) ||
-                       __get_user(txc->constant, &utp->constant) ||
-                       __get_user(txc->precision, &utp->precision) ||
-                       __get_user(txc->tolerance, &utp->tolerance) ||
-                       __get_user(txc->time.tv_sec, &utp->time.tv_sec) ||
-                       __get_user(txc->time.tv_usec, &utp->time.tv_usec) ||
-                       __get_user(txc->tick, &utp->tick) ||
-                       __get_user(txc->ppsfreq, &utp->ppsfreq) ||
-                       __get_user(txc->jitter, &utp->jitter) ||
-                       __get_user(txc->shift, &utp->shift) ||
-                       __get_user(txc->stabil, &utp->stabil) ||
-                       __get_user(txc->jitcnt, &utp->jitcnt) ||
-                       __get_user(txc->calcnt, &utp->calcnt) ||
-                       __get_user(txc->errcnt, &utp->errcnt) ||
-                       __get_user(txc->stbcnt, &utp->stbcnt))
-               return -EFAULT;
-
-       return 0;
-}
+       struct compat_timex tx32;
 
-static int compat_put_timex(struct compat_timex __user *utp, struct timex *txc)
-{
-       if (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) ||
-                       __put_user(txc->modes, &utp->modes) ||
-                       __put_user(txc->offset, &utp->offset) ||
-                       __put_user(txc->freq, &utp->freq) ||
-                       __put_user(txc->maxerror, &utp->maxerror) ||
-                       __put_user(txc->esterror, &utp->esterror) ||
-                       __put_user(txc->status, &utp->status) ||
-                       __put_user(txc->constant, &utp->constant) ||
-                       __put_user(txc->precision, &utp->precision) ||
-                       __put_user(txc->tolerance, &utp->tolerance) ||
-                       __put_user(txc->time.tv_sec, &utp->time.tv_sec) ||
-                       __put_user(txc->time.tv_usec, &utp->time.tv_usec) ||
-                       __put_user(txc->tick, &utp->tick) ||
-                       __put_user(txc->ppsfreq, &utp->ppsfreq) ||
-                       __put_user(txc->jitter, &utp->jitter) ||
-                       __put_user(txc->shift, &utp->shift) ||
-                       __put_user(txc->stabil, &utp->stabil) ||
-                       __put_user(txc->jitcnt, &utp->jitcnt) ||
-                       __put_user(txc->calcnt, &utp->calcnt) ||
-                       __put_user(txc->errcnt, &utp->errcnt) ||
-                       __put_user(txc->stbcnt, &utp->stbcnt) ||
-                       __put_user(txc->tai, &utp->tai))
+       if (copy_from_user(&tx32, utp, sizeof(struct compat_timex)))
                return -EFAULT;
-       return 0;
-}
 
-COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv,
-                      struct timezone __user *, tz)
-{
-       if (tv) {
-               struct timeval ktv;
-               do_gettimeofday(&ktv);
-               if (compat_put_timeval(&ktv, tv))
-                       return -EFAULT;
-       }
-       if (tz) {
-               if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
-                       return -EFAULT;
-       }
+       txc->modes = tx32.modes;
+       txc->offset = tx32.offset;
+       txc->freq = tx32.freq;
+       txc->maxerror = tx32.maxerror;
+       txc->esterror = tx32.esterror;
+       txc->status = tx32.status;
+       txc->constant = tx32.constant;
+       txc->precision = tx32.precision;
+       txc->tolerance = tx32.tolerance;
+       txc->time.tv_sec = tx32.time.tv_sec;
+       txc->time.tv_usec = tx32.time.tv_usec;
+       txc->tick = tx32.tick;
+       txc->ppsfreq = tx32.ppsfreq;
+       txc->jitter = tx32.jitter;
+       txc->shift = tx32.shift;
+       txc->stabil = tx32.stabil;
+       txc->jitcnt = tx32.jitcnt;
+       txc->calcnt = tx32.calcnt;
+       txc->errcnt = tx32.errcnt;
+       txc->stbcnt = tx32.stbcnt;
 
        return 0;
 }
 
-COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv,
-                      struct timezone __user *, tz)
-{
-       struct timespec64 new_ts;
-       struct timeval user_tv;
-       struct timezone new_tz;
-
-       if (tv) {
-               if (compat_get_timeval(&user_tv, tv))
-                       return -EFAULT;
-               new_ts.tv_sec = user_tv.tv_sec;
-               new_ts.tv_nsec = user_tv.tv_usec * NSEC_PER_USEC;
-       }
-       if (tz) {
-               if (copy_from_user(&new_tz, tz, sizeof(*tz)))
-                       return -EFAULT;
-       }
-
-       return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
+int compat_put_timex(struct compat_timex __user *utp, const struct timex *txc)
+{
+       struct compat_timex tx32;
+
+       memset(&tx32, 0, sizeof(struct compat_timex));
+       tx32.modes = txc->modes;
+       tx32.offset = txc->offset;
+       tx32.freq = txc->freq;
+       tx32.maxerror = txc->maxerror;
+       tx32.esterror = txc->esterror;
+       tx32.status = txc->status;
+       tx32.constant = txc->constant;
+       tx32.precision = txc->precision;
+       tx32.tolerance = txc->tolerance;
+       tx32.time.tv_sec = txc->time.tv_sec;
+       tx32.time.tv_usec = txc->time.tv_usec;
+       tx32.tick = txc->tick;
+       tx32.ppsfreq = txc->ppsfreq;
+       tx32.jitter = txc->jitter;
+       tx32.shift = txc->shift;
+       tx32.stabil = txc->stabil;
+       tx32.jitcnt = txc->jitcnt;
+       tx32.calcnt = txc->calcnt;
+       tx32.errcnt = txc->errcnt;
+       tx32.stbcnt = txc->stbcnt;
+       tx32.tai = txc->tai;
+       if (copy_to_user(utp, &tx32, sizeof(struct compat_timex)))
+               return -EFAULT;
+       return 0;
 }
 
 static int __compat_get_timeval(struct timeval *tv, const struct compat_timeval __user *ctv)
@@ -154,6 +120,50 @@ static int __compat_put_timespec(const struct timespec *ts, struct compat_timesp
                        __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
 }
 
+static int __compat_get_timespec64(struct timespec64 *ts64,
+                                  const struct compat_timespec __user *cts)
+{
+       struct compat_timespec ts;
+       int ret;
+
+       ret = copy_from_user(&ts, cts, sizeof(ts));
+       if (ret)
+               return -EFAULT;
+
+       ts64->tv_sec = ts.tv_sec;
+       ts64->tv_nsec = ts.tv_nsec;
+
+       return 0;
+}
+
+static int __compat_put_timespec64(const struct timespec64 *ts64,
+                                  struct compat_timespec __user *cts)
+{
+       struct compat_timespec ts = {
+               .tv_sec = ts64->tv_sec,
+               .tv_nsec = ts64->tv_nsec
+       };
+       return copy_to_user(cts, &ts, sizeof(ts)) ? -EFAULT : 0;
+}
+
+int compat_get_timespec64(struct timespec64 *ts, const void __user *uts)
+{
+       if (COMPAT_USE_64BIT_TIME)
+               return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0;
+       else
+               return __compat_get_timespec64(ts, uts);
+}
+EXPORT_SYMBOL_GPL(compat_get_timespec64);
+
+int compat_put_timespec64(const struct timespec64 *ts, void __user *uts)
+{
+       if (COMPAT_USE_64BIT_TIME)
+               return copy_to_user(uts, ts, sizeof(*ts)) ? -EFAULT : 0;
+       else
+               return __compat_put_timespec64(ts, uts);
+}
+EXPORT_SYMBOL_GPL(compat_put_timespec64);
+
 int compat_get_timeval(struct timeval *tv, const void __user *utv)
 {
        if (COMPAT_USE_64BIT_TIME)
@@ -213,141 +223,28 @@ int compat_convert_timespec(struct timespec __user **kts,
        return 0;
 }
 
-static long compat_nanosleep_restart(struct restart_block *restart)
+int get_compat_itimerval(struct itimerval *o, const struct compat_itimerval __user *i)
 {
-       struct compat_timespec __user *rmtp;
-       struct timespec rmt;
-       mm_segment_t oldfs;
-       long ret;
-
-       restart->nanosleep.rmtp = (struct timespec __user *) &rmt;
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = hrtimer_nanosleep_restart(restart);
-       set_fs(oldfs);
-
-       if (ret == -ERESTART_RESTARTBLOCK) {
-               rmtp = restart->nanosleep.compat_rmtp;
+       struct compat_itimerval v32;
 
-               if (rmtp && compat_put_timespec(&rmt, rmtp))
-                       return -EFAULT;
-       }
-
-       return ret;
-}
-
-COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp,
-                      struct compat_timespec __user *, rmtp)
-{
-       struct timespec tu, rmt;
-       struct timespec64 tu64;
-       mm_segment_t oldfs;
-       long ret;
-
-       if (compat_get_timespec(&tu, rqtp))
+       if (copy_from_user(&v32, i, sizeof(struct compat_itimerval)))
                return -EFAULT;
-
-       tu64 = timespec_to_timespec64(tu);
-       if (!timespec64_valid(&tu64))
-               return -EINVAL;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = hrtimer_nanosleep(&tu64,
-                               rmtp ? (struct timespec __user *)&rmt : NULL,
-                               HRTIMER_MODE_REL, CLOCK_MONOTONIC);
-       set_fs(oldfs);
-
-       /*
-        * hrtimer_nanosleep() can only return 0 or
-        * -ERESTART_RESTARTBLOCK here because:
-        *
-        * - we call it with HRTIMER_MODE_REL and therefor exclude the
-        *   -ERESTARTNOHAND return path.
-        *
-        * - we supply the rmtp argument from the task stack (due to
-        *   the necessary compat conversion. So the update cannot
-        *   fail, which excludes the -EFAULT return path as well. If
-        *   it fails nevertheless we have a bigger problem and wont
-        *   reach this place anymore.
-        *
-        * - if the return value is 0, we do not have to update rmtp
-        *    because there is no remaining time.
-        *
-        * We check for -ERESTART_RESTARTBLOCK nevertheless if the
-        * core implementation decides to return random nonsense.
-        */
-       if (ret == -ERESTART_RESTARTBLOCK) {
-               struct restart_block *restart = &current->restart_block;
-
-               restart->fn = compat_nanosleep_restart;
-               restart->nanosleep.compat_rmtp = rmtp;
-
-               if (rmtp && compat_put_timespec(&rmt, rmtp))
-                       return -EFAULT;
-       }
-       return ret;
-}
-
-static inline long get_compat_itimerval(struct itimerval *o,
-               struct compat_itimerval __user *i)
-{
-       return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
-               (__get_user(o->it_interval.tv_sec, &i->it_interval.tv_sec) |
-                __get_user(o->it_interval.tv_usec, &i->it_interval.tv_usec) |
-                __get_user(o->it_value.tv_sec, &i->it_value.tv_sec) |
-                __get_user(o->it_value.tv_usec, &i->it_value.tv_usec)));
-}
-
-static inline long put_compat_itimerval(struct compat_itimerval __user *o,
-               struct itimerval *i)
-{
-       return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
-               (__put_user(i->it_interval.tv_sec, &o->it_interval.tv_sec) |
-                __put_user(i->it_interval.tv_usec, &o->it_interval.tv_usec) |
-                __put_user(i->it_value.tv_sec, &o->it_value.tv_sec) |
-                __put_user(i->it_value.tv_usec, &o->it_value.tv_usec)));
-}
-
-asmlinkage long sys_ni_posix_timers(void);
-
-COMPAT_SYSCALL_DEFINE2(getitimer, int, which,
-               struct compat_itimerval __user *, it)
-{
-       struct itimerval kit;
-       int error;
-
-       if (!IS_ENABLED(CONFIG_POSIX_TIMERS))
-               return sys_ni_posix_timers();
-
-       error = do_getitimer(which, &kit);
-       if (!error && put_compat_itimerval(it, &kit))
-               error = -EFAULT;
-       return error;
+       o->it_interval.tv_sec = v32.it_interval.tv_sec;
+       o->it_interval.tv_usec = v32.it_interval.tv_usec;
+       o->it_value.tv_sec = v32.it_value.tv_sec;
+       o->it_value.tv_usec = v32.it_value.tv_usec;
+       return 0;
 }
 
-COMPAT_SYSCALL_DEFINE3(setitimer, int, which,
-               struct compat_itimerval __user *, in,
-               struct compat_itimerval __user *, out)
+int put_compat_itimerval(struct compat_itimerval __user *o, const struct itimerval *i)
 {
-       struct itimerval kin, kout;
-       int error;
-
-       if (!IS_ENABLED(CONFIG_POSIX_TIMERS))
-               return sys_ni_posix_timers();
-
-       if (in) {
-               if (get_compat_itimerval(&kin, in))
-                       return -EFAULT;
-       } else
-               memset(&kin, 0, sizeof(kin));
+       struct compat_itimerval v32;
 
-       error = do_setitimer(which, &kin, out ? &kout : NULL);
-       if (error || !out)
-               return error;
-       if (put_compat_itimerval(out, &kout))
-               return -EFAULT;
-       return 0;
+       v32.it_interval.tv_sec = i->it_interval.tv_sec;
+       v32.it_interval.tv_usec = i->it_interval.tv_usec;
+       v32.it_value.tv_sec = i->it_value.tv_sec;
+       v32.it_value.tv_usec = i->it_value.tv_usec;
+       return copy_to_user(o, &v32, sizeof(struct compat_itimerval)) ? -EFAULT : 0;
 }
 
 static compat_clock_t clock_t_to_compat_clock_t(clock_t x)
@@ -543,72 +440,6 @@ int put_compat_rusage(const struct rusage *r, struct compat_rusage __user *ru)
        return 0;
 }
 
-COMPAT_SYSCALL_DEFINE4(wait4,
-       compat_pid_t, pid,
-       compat_uint_t __user *, stat_addr,
-       int, options,
-       struct compat_rusage __user *, ru)
-{
-       if (!ru) {
-               return sys_wait4(pid, stat_addr, options, NULL);
-       } else {
-               struct rusage r;
-               int ret;
-               unsigned int status;
-               mm_segment_t old_fs = get_fs();
-
-               set_fs (KERNEL_DS);
-               ret = sys_wait4(pid,
-                               (stat_addr ?
-                                (unsigned int __user *) &status : NULL),
-                               options, (struct rusage __user *) &r);
-               set_fs (old_fs);
-
-               if (ret > 0) {
-                       if (put_compat_rusage(&r, ru))
-                               return -EFAULT;
-                       if (stat_addr && put_user(status, stat_addr))
-                               return -EFAULT;
-               }
-               return ret;
-       }
-}
-
-COMPAT_SYSCALL_DEFINE5(waitid,
-               int, which, compat_pid_t, pid,
-               struct compat_siginfo __user *, uinfo, int, options,
-               struct compat_rusage __user *, uru)
-{
-       siginfo_t info;
-       struct rusage ru;
-       long ret;
-       mm_segment_t old_fs = get_fs();
-
-       memset(&info, 0, sizeof(info));
-
-       set_fs(KERNEL_DS);
-       ret = sys_waitid(which, pid, (siginfo_t __user *)&info, options,
-                        uru ? (struct rusage __user *)&ru : NULL);
-       set_fs(old_fs);
-
-       if ((ret < 0) || (info.si_signo == 0))
-               return ret;
-
-       if (uru) {
-               /* sys_waitid() overwrites everything in ru */
-               if (COMPAT_USE_64BIT_TIME)
-                       ret = copy_to_user(uru, &ru, sizeof(ru));
-               else
-                       ret = put_compat_rusage(&ru, uru);
-               if (ret)
-                       return -EFAULT;
-       }
-
-       BUG_ON(info.si_code & __SI_MASK);
-       info.si_code |= __SI_CHLD;
-       return copy_siginfo_to_user32(uinfo, &info);
-}
-
 static int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr,
                                    unsigned len, struct cpumask *new_mask)
 {
@@ -689,192 +520,26 @@ int put_compat_itimerspec(struct compat_itimerspec __user *dst,
        return 0;
 }
 
-COMPAT_SYSCALL_DEFINE3(timer_create, clockid_t, which_clock,
-                      struct compat_sigevent __user *, timer_event_spec,
-                      timer_t __user *, created_timer_id)
-{
-       struct sigevent __user *event = NULL;
-
-       if (timer_event_spec) {
-               struct sigevent kevent;
-
-               event = compat_alloc_user_space(sizeof(*event));
-               if (get_compat_sigevent(&kevent, timer_event_spec) ||
-                   copy_to_user(event, &kevent, sizeof(*event)))
-                       return -EFAULT;
-       }
-
-       return sys_timer_create(which_clock, event, created_timer_id);
-}
-
-COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
-                      struct compat_itimerspec __user *, new,
-                      struct compat_itimerspec __user *, old)
-{
-       long err;
-       mm_segment_t oldfs;
-       struct itimerspec newts, oldts;
-
-       if (!new)
-               return -EINVAL;
-       if (get_compat_itimerspec(&newts, new))
-               return -EFAULT;
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_timer_settime(timer_id, flags,
-                               (struct itimerspec __user *) &newts,
-                               (struct itimerspec __user *) &oldts);
-       set_fs(oldfs);
-       if (!err && old && put_compat_itimerspec(old, &oldts))
-               return -EFAULT;
-       return err;
-}
-
-COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
-                      struct compat_itimerspec __user *, setting)
-{
-       long err;
-       mm_segment_t oldfs;
-       struct itimerspec ts;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_timer_gettime(timer_id,
-                               (struct itimerspec __user *) &ts);
-       set_fs(oldfs);
-       if (!err && put_compat_itimerspec(setting, &ts))
-               return -EFAULT;
-       return err;
-}
-
-COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock,
-                      struct compat_timespec __user *, tp)
-{
-       long err;
-       mm_segment_t oldfs;
-       struct timespec ts;
-
-       if (compat_get_timespec(&ts, tp))
-               return -EFAULT;
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_clock_settime(which_clock,
-                               (struct timespec __user *) &ts);
-       set_fs(oldfs);
-       return err;
-}
-
-COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
-                      struct compat_timespec __user *, tp)
-{
-       long err;
-       mm_segment_t oldfs;
-       struct timespec ts;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_clock_gettime(which_clock,
-                               (struct timespec __user *) &ts);
-       set_fs(oldfs);
-       if (!err && compat_put_timespec(&ts, tp))
-               return -EFAULT;
-       return err;
-}
-
-COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock,
-                      struct compat_timex __user *, utp)
-{
-       struct timex txc;
-       mm_segment_t oldfs;
-       int err, ret;
-
-       err = compat_get_timex(&txc, utp);
-       if (err)
-               return err;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = sys_clock_adjtime(which_clock, (struct timex __user *) &txc);
-       set_fs(oldfs);
-
-       err = compat_put_timex(utp, &txc);
-       if (err)
-               return err;
-
-       return ret;
-}
-
-COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
-                      struct compat_timespec __user *, tp)
+int get_compat_itimerspec64(struct itimerspec64 *its,
+                       const struct compat_itimerspec __user *uits)
 {
-       long err;
-       mm_segment_t oldfs;
-       struct timespec ts;
 
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_clock_getres(which_clock,
-                              (struct timespec __user *) &ts);
-       set_fs(oldfs);
-       if (!err && tp && compat_put_timespec(&ts, tp))
+       if (__compat_get_timespec64(&its->it_interval, &uits->it_interval) ||
+           __compat_get_timespec64(&its->it_value, &uits->it_value))
                return -EFAULT;
-       return err;
+       return 0;
 }
+EXPORT_SYMBOL_GPL(get_compat_itimerspec64);
 
-static long compat_clock_nanosleep_restart(struct restart_block *restart)
+int put_compat_itimerspec64(const struct itimerspec64 *its,
+                       struct compat_itimerspec __user *uits)
 {
-       long err;
-       mm_segment_t oldfs;
-       struct timespec tu;
-       struct compat_timespec __user *rmtp = restart->nanosleep.compat_rmtp;
-
-       restart->nanosleep.rmtp = (struct timespec __user *) &tu;
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = clock_nanosleep_restart(restart);
-       set_fs(oldfs);
-
-       if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
-           compat_put_timespec(&tu, rmtp))
+       if (__compat_put_timespec64(&its->it_interval, &uits->it_interval) ||
+           __compat_put_timespec64(&its->it_value, &uits->it_value))
                return -EFAULT;
-
-       if (err == -ERESTART_RESTARTBLOCK) {
-               restart->fn = compat_clock_nanosleep_restart;
-               restart->nanosleep.compat_rmtp = rmtp;
-       }
-       return err;
-}
-
-COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
-                      struct compat_timespec __user *, rqtp,
-                      struct compat_timespec __user *, rmtp)
-{
-       long err;
-       mm_segment_t oldfs;
-       struct timespec in, out;
-       struct restart_block *restart;
-
-       if (compat_get_timespec(&in, rqtp))
-               return -EFAULT;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_clock_nanosleep(which_clock, flags,
-                                 (struct timespec __user *) &in,
-                                 (struct timespec __user *) &out);
-       set_fs(oldfs);
-
-       if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
-           compat_put_timespec(&out, rmtp))
-               return -EFAULT;
-
-       if (err == -ERESTART_RESTARTBLOCK) {
-               restart = &current->restart_block;
-               restart->fn = compat_clock_nanosleep_restart;
-               restart->nanosleep.compat_rmtp = rmtp;
-       }
-       return err;
+       return 0;
 }
+EXPORT_SYMBOL_GPL(put_compat_itimerspec64);
 
 /*
  * We currently only need the following fields from the sigevent
@@ -1035,64 +700,6 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
        return ret;
 }
 
-#ifdef __ARCH_WANT_COMPAT_SYS_TIME
-
-/* compat_time_t is a 32 bit "long" and needs to get converted. */
-
-COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc)
-{
-       compat_time_t i;
-       struct timeval tv;
-
-       do_gettimeofday(&tv);
-       i = tv.tv_sec;
-
-       if (tloc) {
-               if (put_user(i,tloc))
-                       return -EFAULT;
-       }
-       force_successful_syscall_return();
-       return i;
-}
-
-COMPAT_SYSCALL_DEFINE1(stime, compat_time_t __user *, tptr)
-{
-       struct timespec tv;
-       int err;
-
-       if (get_user(tv.tv_sec, tptr))
-               return -EFAULT;
-
-       tv.tv_nsec = 0;
-
-       err = security_settime(&tv, NULL);
-       if (err)
-               return err;
-
-       do_settimeofday(&tv);
-       return 0;
-}
-
-#endif /* __ARCH_WANT_COMPAT_SYS_TIME */
-
-COMPAT_SYSCALL_DEFINE1(adjtimex, struct compat_timex __user *, utp)
-{
-       struct timex txc;
-       int err, ret;
-
-       err = compat_get_timex(&txc, utp);
-       if (err)
-               return err;
-
-       ret = do_adjtimex(&txc);
-
-       err = compat_put_timex(utp, &txc);
-       if (err)
-               return err;
-
-       return ret;
-}
-
 #ifdef CONFIG_NUMA
 COMPAT_SYSCALL_DEFINE6(move_pages, pid_t, pid, compat_ulong_t, nr_pages,
                       compat_uptr_t __user *, pages32,