summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-05 15:34:35 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-05 15:34:35 -0700
commitea3b25e1320df4e575c323b6ab22a5fc79976fbe (patch)
treeee824920b52a6458e383bc2b057cc5508e60fafe /include
parent89fbf5384ddf666a595eb6562dc63fcbfeb8f6a5 (diff)
parent725816e8aabb1c183baa2bc9572ab9a0d26b9ea1 (diff)
downloadlinux-ea3b25e1320df4e575c323b6ab22a5fc79976fbe.tar.bz2
Merge branch 'timers-compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull timer-related user access updates from Al Viro: "Continuation of timers-related stuff (there had been more, but my parts of that series are already merged via timers/core). This is more of y2038 work by Deepa Dinamani, partially disrupted by the unification of native and compat timers-related syscalls" * 'timers-compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: posix_clocks: Use get_itimerspec64() and put_itimerspec64() timerfd: Use get_itimerspec64() and put_itimerspec64() nanosleep: Use get_timespec64() and put_timespec64() posix-timers: Use get_timespec64() and put_timespec64() posix-stubs: Conditionally include COMPAT_SYS_NI defines time: introduce {get,put}_itimerspec64 time: add get_timespec64 and put_timespec64
Diffstat (limited to 'include')
-rw-r--r--include/linux/compat.h6
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/posix-timers.h1
-rw-r--r--include/linux/time.h18
4 files changed, 25 insertions, 2 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 425563c7647b..2ed54020ace0 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -164,6 +164,12 @@ extern int compat_get_timespec(struct timespec *, const void __user *);
extern int compat_put_timespec(const struct timespec *, void __user *);
extern int compat_get_timeval(struct timeval *, const void __user *);
extern int compat_put_timeval(const struct timeval *, void __user *);
+extern int compat_get_timespec64(struct timespec64 *, const void __user *);
+extern int compat_put_timespec64(const struct timespec64 *, void __user *);
+extern int get_compat_itimerspec64(struct itimerspec64 *its,
+ const struct compat_itimerspec __user *uits);
+extern int put_compat_itimerspec64(const struct itimerspec64 *its,
+ struct compat_itimerspec __user *uits);
/*
* This function convert a timespec if necessary and returns a *user
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 255edd5e7a74..012c37fdb688 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -453,7 +453,7 @@ static inline u64 hrtimer_forward_now(struct hrtimer *timer,
/* Precise sleep: */
-extern int nanosleep_copyout(struct restart_block *, struct timespec *);
+extern int nanosleep_copyout(struct restart_block *, struct timespec64 *);
extern long hrtimer_nanosleep(const struct timespec64 *rqtp,
const enum hrtimer_mode mode,
const clockid_t clockid);
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 29f1b7f09ced..62839fd04dce 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -113,5 +113,4 @@ void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
void update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new);
void posixtimer_rearm(struct siginfo *info);
-
#endif
diff --git a/include/linux/time.h b/include/linux/time.h
index c0543f5f25de..f9858d7e6361 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -8,6 +8,15 @@
extern struct timezone sys_tz;
+int get_timespec64(struct timespec64 *ts,
+ const struct timespec __user *uts);
+int put_timespec64(const struct timespec64 *ts,
+ struct timespec __user *uts);
+int get_itimerspec64(struct itimerspec64 *it,
+ const struct itimerspec __user *uit);
+int put_itimerspec64(const struct itimerspec64 *it,
+ struct itimerspec __user *uit);
+
#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
static inline int timespec_equal(const struct timespec *a,
@@ -270,4 +279,13 @@ static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
a->tv_nsec = ns;
}
+static inline bool itimerspec64_valid(const struct itimerspec64 *its)
+{
+ if (!timespec64_valid(&(its->it_interval)) ||
+ !timespec64_valid(&(its->it_value)))
+ return false;
+
+ return true;
+}
+
#endif