diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 20:27:54 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 20:27:54 -0700 |
commit | 0bbcce5d1ef3f771a349896f1c7574d20dc6f4bd (patch) | |
tree | 8a26c5f63eac55cbedff506bba22d32f8669fd5c /include/linux | |
parent | 0ef283d4c7808cb264f904de5e29a0b661747fc4 (diff) | |
parent | e45e778f078efaac085e50366fe06d7b83c8b881 (diff) | |
download | linux-0bbcce5d1ef3f771a349896f1c7574d20dc6f4bd.tar.gz linux-0bbcce5d1ef3f771a349896f1c7574d20dc6f4bd.tar.bz2 linux-0bbcce5d1ef3f771a349896f1c7574d20dc6f4bd.zip |
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timers and timekeeping updates from Thomas Gleixner:
- Core infrastucture work for Y2038 to address the COMPAT interfaces:
+ Add a new Y2038 safe __kernel_timespec and use it in the core
code
+ Introduce config switches which allow to control the various
compat mechanisms
+ Use the new config switch in the posix timer code to control the
32bit compat syscall implementation.
- Prevent bogus selection of CPU local clocksources which causes an
endless reselection loop
- Remove the extra kthread in the clocksource code which has no value
and just adds another level of indirection
- The usual bunch of trivial updates, cleanups and fixlets all over the
place
- More SPDX conversions
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
clocksource/drivers/mxs_timer: Switch to SPDX identifier
clocksource/drivers/timer-imx-tpm: Switch to SPDX identifier
clocksource/drivers/timer-imx-gpt: Switch to SPDX identifier
clocksource/drivers/timer-imx-gpt: Remove outdated file path
clocksource/drivers/arc_timer: Add comments about locking while read GFRC
clocksource/drivers/mips-gic-timer: Add pr_fmt and reword pr_* messages
clocksource/drivers/sprd: Fix Kconfig dependency
clocksource: Move inline keyword to the beginning of function declarations
timer_list: Remove unused function pointer typedef
timers: Adjust a kernel-doc comment
tick: Prefer a lower rating device only if it's CPU local device
clocksource: Remove kthread
time: Change nanosleep to safe __kernel_* types
time: Change types to new y2038 safe __kernel_* types
time: Fix get_timespec64() for y2038 safe compat interfaces
time: Add new y2038 safe __kernel_timespec
posix-timers: Make compat syscalls depend on CONFIG_COMPAT_32BIT_TIME
time: Introduce CONFIG_COMPAT_32BIT_TIME
time: Introduce CONFIG_64BIT_TIME in architectures
compat: Enable compat_get/put_timespec64 always
...
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/compat.h | 12 | ||||
-rw-r--r-- | include/linux/compat_time.h | 23 | ||||
-rw-r--r-- | include/linux/restart_block.h | 7 | ||||
-rw-r--r-- | include/linux/syscalls.h | 13 | ||||
-rw-r--r-- | include/linux/time.h | 4 | ||||
-rw-r--r-- | include/linux/time64.h | 10 |
6 files changed, 51 insertions, 18 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h index ad192057b887..b1a5562b3215 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -7,8 +7,7 @@ */ #include <linux/types.h> - -#ifdef CONFIG_COMPAT +#include <linux/compat_time.h> #include <linux/stat.h> #include <linux/param.h> /* for HZ */ @@ -21,8 +20,11 @@ #include <linux/unistd.h> #include <asm/compat.h> + +#ifdef CONFIG_COMPAT #include <asm/siginfo.h> #include <asm/signal.h> +#endif #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER /* @@ -83,6 +85,8 @@ static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) #endif /* COMPAT_SYSCALL_DEFINEx */ +#ifdef CONFIG_COMPAT + #ifndef compat_user_stack_pointer #define compat_user_stack_pointer() current_user_stack_pointer() #endif @@ -290,8 +294,6 @@ 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, @@ -1023,7 +1025,9 @@ static inline struct compat_timeval ns_to_compat_timeval(s64 nsec) #else /* !CONFIG_COMPAT */ #define is_compat_task() (0) +#ifndef in_compat_syscall static inline bool in_compat_syscall(void) { return false; } +#endif #endif /* CONFIG_COMPAT */ diff --git a/include/linux/compat_time.h b/include/linux/compat_time.h new file mode 100644 index 000000000000..31f2774f1994 --- /dev/null +++ b/include/linux/compat_time.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_COMPAT_TIME_H +#define _LINUX_COMPAT_TIME_H + +#include <linux/types.h> +#include <linux/time64.h> + +typedef s32 compat_time_t; + +struct compat_timespec { + compat_time_t tv_sec; + s32 tv_nsec; +}; + +struct compat_timeval { + compat_time_t tv_sec; + s32 tv_usec; +}; + +extern int compat_get_timespec64(struct timespec64 *, const void __user *); +extern int compat_put_timespec64(const struct timespec64 *, void __user *); + +#endif /* _LINUX_COMPAT_TIME_H */ diff --git a/include/linux/restart_block.h b/include/linux/restart_block.h index bcfdb918cd81..5d83d0c1d06c 100644 --- a/include/linux/restart_block.h +++ b/include/linux/restart_block.h @@ -7,6 +7,7 @@ #include <linux/compiler.h> #include <linux/types.h> +#include <linux/time64.h> struct timespec; struct compat_timespec; @@ -15,9 +16,7 @@ struct pollfd; enum timespec_type { TT_NONE = 0, TT_NATIVE = 1, -#ifdef CONFIG_COMPAT TT_COMPAT = 2, -#endif }; /* @@ -40,10 +39,8 @@ struct restart_block { clockid_t clockid; enum timespec_type type; union { - struct timespec __user *rmtp; -#ifdef CONFIG_COMPAT + struct __kernel_timespec __user *rmtp; struct compat_timespec __user *compat_rmtp; -#endif }; u64 expires; } nanosleep; diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 811172fcb916..796ea267f1c7 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -542,7 +542,8 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, size_t len); /* kernel/hrtimer.c */ -asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp); +asmlinkage long sys_nanosleep(struct __kernel_timespec __user *rqtp, + struct __kernel_timespec __user *rmtp); /* kernel/itimer.c */ asmlinkage long sys_getitimer(int which, struct itimerval __user *value); @@ -573,14 +574,14 @@ asmlinkage long sys_timer_settime(timer_t timer_id, int flags, struct itimerspec __user *old_setting); asmlinkage long sys_timer_delete(timer_t timer_id); asmlinkage long sys_clock_settime(clockid_t which_clock, - const struct timespec __user *tp); + const struct __kernel_timespec __user *tp); asmlinkage long sys_clock_gettime(clockid_t which_clock, - struct timespec __user *tp); + struct __kernel_timespec __user *tp); asmlinkage long sys_clock_getres(clockid_t which_clock, - struct timespec __user *tp); + struct __kernel_timespec __user *tp); asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags, - const struct timespec __user *rqtp, - struct timespec __user *rmtp); + const struct __kernel_timespec __user *rqtp, + struct __kernel_timespec __user *rmtp); /* kernel/printk.c */ asmlinkage long sys_syslog(int type, char __user *buf, int len); diff --git a/include/linux/time.h b/include/linux/time.h index 4b62a2c0a661..aed74463592d 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -10,9 +10,9 @@ extern struct timezone sys_tz; int get_timespec64(struct timespec64 *ts, - const struct timespec __user *uts); + const struct __kernel_timespec __user *uts); int put_timespec64(const struct timespec64 *ts, - struct timespec __user *uts); + struct __kernel_timespec __user *uts); int get_itimerspec64(struct itimerspec64 *it, const struct itimerspec __user *uit); int put_itimerspec64(const struct itimerspec64 *it, diff --git a/include/linux/time64.h b/include/linux/time64.h index 93d39499838e..0d96887ba4e0 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -2,12 +2,20 @@ #ifndef _LINUX_TIME64_H #define _LINUX_TIME64_H -#include <uapi/linux/time.h> #include <linux/math64.h> typedef __s64 time64_t; typedef __u64 timeu64_t; +/* CONFIG_64BIT_TIME enables new 64 bit time_t syscalls in the compat path + * and 32-bit emulation. + */ +#ifndef CONFIG_64BIT_TIME +#define __kernel_timespec timespec +#endif + +#include <uapi/linux/time.h> + #if __BITS_PER_LONG == 64 /* this trick allows us to optimize out timespec64_to_timespec */ # define timespec64 timespec |