aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-28 15:45:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-28 15:45:04 -0500
commitb12a9124eeb71d766a3e3eb594ebbb3fefc66902 (patch)
tree1803ac4abd3be73241e58b9da0c4fb71295137b4 /include/linux
parent1a80dade010c7a7f4885a4c4c2a7ac22cc7b34df (diff)
parente4b92b108c6cd6b311e4b6e85d6a87a34599a6e3 (diff)
Merge tag 'y2038-for-4.21' of ssh://gitolite.kernel.org:/pub/scm/linux/kernel/git/arnd/playground
Pull y2038 updates from Arnd Bergmann: "More syscalls and cleanups This concludes the main part of the system call rework for 64-bit time_t, which has spread over most of year 2018, the last six system calls being - ppoll - pselect6 - io_pgetevents - recvmmsg - futex - rt_sigtimedwait As before, nothing changes for 64-bit architectures, while 32-bit architectures gain another entry point that differs only in the layout of the timespec structure. Hopefully in the next release we can wire up all 22 of those system calls on all 32-bit architectures, which gives us a baseline version for glibc to start using them. This does not include the clock_adjtime, getrusage/waitid, and getitimer/setitimer system calls. I still plan to have new versions of those as well, but they are not required for correct operation of the C library since they can be emulated using the old 32-bit time_t based system calls. Aside from the system calls, there are also a few cleanups here, removing old kernel internal interfaces that have become unused after all references got removed. The arch/sh cleanups are part of this, there were posted several times over the past year without a reaction from the maintainers, while the corresponding changes made it into all other architectures" * tag 'y2038-for-4.21' of ssh://gitolite.kernel.org:/pub/scm/linux/kernel/git/arnd/playground: timekeeping: remove obsolete time accessors vfs: replace current_kernel_time64 with ktime equivalent timekeeping: remove timespec_add/timespec_del timekeeping: remove unused {read,update}_persistent_clock sh: remove board_time_init() callback sh: remove unused rtc_sh_get/set_time infrastructure sh: sh03: rtc: push down rtc class ops into driver sh: dreamcast: rtc: push down rtc class ops into driver y2038: signal: Add compat_sys_rt_sigtimedwait_time64 y2038: signal: Add sys_rt_sigtimedwait_time32 y2038: socket: Add compat_sys_recvmmsg_time64 y2038: futex: Add support for __kernel_timespec y2038: futex: Move compat implementation into futex.c io_pgetevents: use __kernel_timespec pselect6: use __kernel_timespec ppoll: use __kernel_timespec signal: Add restore_user_sigmask() signal: Add set_user_sigmask()
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compat.h26
-rw-r--r--include/linux/futex.h8
-rw-r--r--include/linux/signal.h4
-rw-r--r--include/linux/socket.h9
-rw-r--r--include/linux/syscalls.h29
-rw-r--r--include/linux/time32.h25
-rw-r--r--include/linux/timekeeping.h14
-rw-r--r--include/linux/timekeeping32.h15
8 files changed, 60 insertions, 70 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 88720b443cd6..056be0d03722 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -169,6 +169,10 @@ typedef struct {
169 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 169 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
170} compat_sigset_t; 170} compat_sigset_t;
171 171
172int set_compat_user_sigmask(const compat_sigset_t __user *usigmask,
173 sigset_t *set, sigset_t *oldset,
174 size_t sigsetsize);
175
172struct compat_sigaction { 176struct compat_sigaction {
173#ifndef __ARCH_HAS_IRIX_SIGACTION 177#ifndef __ARCH_HAS_IRIX_SIGACTION
174 compat_uptr_t sa_handler; 178 compat_uptr_t sa_handler;
@@ -558,6 +562,12 @@ asmlinkage long compat_sys_io_pgetevents(compat_aio_context_t ctx_id,
558 struct io_event __user *events, 562 struct io_event __user *events,
559 struct old_timespec32 __user *timeout, 563 struct old_timespec32 __user *timeout,
560 const struct __compat_aio_sigset __user *usig); 564 const struct __compat_aio_sigset __user *usig);
565asmlinkage long compat_sys_io_pgetevents_time64(compat_aio_context_t ctx_id,
566 compat_long_t min_nr,
567 compat_long_t nr,
568 struct io_event __user *events,
569 struct __kernel_timespec __user *timeout,
570 const struct __compat_aio_sigset __user *usig);
561 571
562/* fs/cookies.c */ 572/* fs/cookies.c */
563asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, compat_size_t); 573asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, compat_size_t);
@@ -643,11 +653,21 @@ asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
643 compat_ulong_t __user *exp, 653 compat_ulong_t __user *exp,
644 struct old_timespec32 __user *tsp, 654 struct old_timespec32 __user *tsp,
645 void __user *sig); 655 void __user *sig);
656asmlinkage long compat_sys_pselect6_time64(int n, compat_ulong_t __user *inp,
657 compat_ulong_t __user *outp,
658 compat_ulong_t __user *exp,
659 struct __kernel_timespec __user *tsp,
660 void __user *sig);
646asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, 661asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
647 unsigned int nfds, 662 unsigned int nfds,
648 struct old_timespec32 __user *tsp, 663 struct old_timespec32 __user *tsp,
649 const compat_sigset_t __user *sigmask, 664 const compat_sigset_t __user *sigmask,
650 compat_size_t sigsetsize); 665 compat_size_t sigsetsize);
666asmlinkage long compat_sys_ppoll_time64(struct pollfd __user *ufds,
667 unsigned int nfds,
668 struct __kernel_timespec __user *tsp,
669 const compat_sigset_t __user *sigmask,
670 compat_size_t sigsetsize);
651 671
652/* fs/signalfd.c */ 672/* fs/signalfd.c */
653asmlinkage long compat_sys_signalfd4(int ufd, 673asmlinkage long compat_sys_signalfd4(int ufd,
@@ -768,6 +788,9 @@ asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
768asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese, 788asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
769 struct compat_siginfo __user *uinfo, 789 struct compat_siginfo __user *uinfo,
770 struct old_timespec32 __user *uts, compat_size_t sigsetsize); 790 struct old_timespec32 __user *uts, compat_size_t sigsetsize);
791asmlinkage long compat_sys_rt_sigtimedwait_time64(compat_sigset_t __user *uthese,
792 struct compat_siginfo __user *uinfo,
793 struct __kernel_timespec __user *uts, compat_size_t sigsetsize);
771asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig, 794asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
772 struct compat_siginfo __user *uinfo); 795 struct compat_siginfo __user *uinfo);
773/* No generic prototype for rt_sigreturn */ 796/* No generic prototype for rt_sigreturn */
@@ -873,6 +896,9 @@ asmlinkage long compat_sys_move_pages(pid_t pid, compat_ulong_t nr_pages,
873asmlinkage long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, 896asmlinkage long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid,
874 compat_pid_t pid, int sig, 897 compat_pid_t pid, int sig,
875 struct compat_siginfo __user *uinfo); 898 struct compat_siginfo __user *uinfo);
899asmlinkage long compat_sys_recvmmsg_time64(int fd, struct compat_mmsghdr __user *mmsg,
900 unsigned vlen, unsigned int flags,
901 struct __kernel_timespec __user *timeout);
876asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, 902asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
877 unsigned vlen, unsigned int flags, 903 unsigned vlen, unsigned int flags,
878 struct old_timespec32 __user *timeout); 904 struct old_timespec32 __user *timeout);
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 821ae502d3d8..ccaef0097785 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -9,9 +9,6 @@ struct inode;
9struct mm_struct; 9struct mm_struct;
10struct task_struct; 10struct task_struct;
11 11
12extern int
13handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi);
14
15/* 12/*
16 * Futexes are matched on equal values of this key. 13 * Futexes are matched on equal values of this key.
17 * The key type depends on whether it's a shared or private mapping. 14 * The key type depends on whether it's a shared or private mapping.
@@ -55,11 +52,6 @@ extern void exit_robust_list(struct task_struct *curr);
55 52
56long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, 53long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
57 u32 __user *uaddr2, u32 val2, u32 val3); 54 u32 __user *uaddr2, u32 val2, u32 val3);
58#ifdef CONFIG_HAVE_FUTEX_CMPXCHG
59#define futex_cmpxchg_enabled 1
60#else
61extern int futex_cmpxchg_enabled;
62#endif
63#else 55#else
64static inline void exit_robust_list(struct task_struct *curr) 56static inline void exit_robust_list(struct task_struct *curr)
65{ 57{
diff --git a/include/linux/signal.h b/include/linux/signal.h
index f428e86f4800..cc7e2c1cd444 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -273,6 +273,10 @@ extern int group_send_sig_info(int sig, struct kernel_siginfo *info,
273 struct task_struct *p, enum pid_type type); 273 struct task_struct *p, enum pid_type type);
274extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *); 274extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *);
275extern int sigprocmask(int, sigset_t *, sigset_t *); 275extern int sigprocmask(int, sigset_t *, sigset_t *);
276extern int set_user_sigmask(const sigset_t __user *usigmask, sigset_t *set,
277 sigset_t *oldset, size_t sigsetsize);
278extern void restore_user_sigmask(const void __user *usigmask,
279 sigset_t *sigsaved);
276extern void set_current_blocked(sigset_t *); 280extern void set_current_blocked(sigset_t *);
277extern void __set_current_blocked(const sigset_t *); 281extern void __set_current_blocked(const sigset_t *);
278extern int show_unhandled_signals; 282extern int show_unhandled_signals;
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 84c48a3c0227..ab2041a00e01 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -349,7 +349,8 @@ struct ucred {
349extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); 349extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
350extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 350extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
351 351
352struct timespec64; 352struct __kernel_timespec;
353struct old_timespec32;
353 354
354/* The __sys_...msg variants allow MSG_CMSG_COMPAT iff 355/* The __sys_...msg variants allow MSG_CMSG_COMPAT iff
355 * forbid_cmsg_compat==false 356 * forbid_cmsg_compat==false
@@ -358,8 +359,10 @@ extern long __sys_recvmsg(int fd, struct user_msghdr __user *msg,
358 unsigned int flags, bool forbid_cmsg_compat); 359 unsigned int flags, bool forbid_cmsg_compat);
359extern long __sys_sendmsg(int fd, struct user_msghdr __user *msg, 360extern long __sys_sendmsg(int fd, struct user_msghdr __user *msg,
360 unsigned int flags, bool forbid_cmsg_compat); 361 unsigned int flags, bool forbid_cmsg_compat);
361extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, 362extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg,
362 unsigned int flags, struct timespec64 *timeout); 363 unsigned int vlen, unsigned int flags,
364 struct __kernel_timespec __user *timeout,
365 struct old_timespec32 __user *timeout32);
363extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, 366extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg,
364 unsigned int vlen, unsigned int flags, 367 unsigned int vlen, unsigned int flags,
365 bool forbid_cmsg_compat); 368 bool forbid_cmsg_compat);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 2ac3d13a915b..251979d2e709 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -296,12 +296,18 @@ asmlinkage long sys_io_getevents(aio_context_t ctx_id,
296 long min_nr, 296 long min_nr,
297 long nr, 297 long nr,
298 struct io_event __user *events, 298 struct io_event __user *events,
299 struct timespec __user *timeout); 299 struct __kernel_timespec __user *timeout);
300asmlinkage long sys_io_pgetevents(aio_context_t ctx_id, 300asmlinkage long sys_io_pgetevents(aio_context_t ctx_id,
301 long min_nr, 301 long min_nr,
302 long nr, 302 long nr,
303 struct io_event __user *events, 303 struct io_event __user *events,
304 struct timespec __user *timeout, 304 struct __kernel_timespec __user *timeout,
305 const struct __aio_sigset *sig);
306asmlinkage long sys_io_pgetevents_time32(aio_context_t ctx_id,
307 long min_nr,
308 long nr,
309 struct io_event __user *events,
310 struct old_timespec32 __user *timeout,
305 const struct __aio_sigset *sig); 311 const struct __aio_sigset *sig);
306 312
307/* fs/xattr.c */ 313/* fs/xattr.c */
@@ -466,10 +472,16 @@ asmlinkage long sys_sendfile64(int out_fd, int in_fd,
466 472
467/* fs/select.c */ 473/* fs/select.c */
468asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *, 474asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
469 fd_set __user *, struct timespec __user *, 475 fd_set __user *, struct __kernel_timespec __user *,
476 void __user *);
477asmlinkage long sys_pselect6_time32(int, fd_set __user *, fd_set __user *,
478 fd_set __user *, struct old_timespec32 __user *,
470 void __user *); 479 void __user *);
471asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, 480asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
472 struct timespec __user *, const sigset_t __user *, 481 struct __kernel_timespec __user *, const sigset_t __user *,
482 size_t);
483asmlinkage long sys_ppoll_time32(struct pollfd __user *, unsigned int,
484 struct old_timespec32 __user *, const sigset_t __user *,
473 size_t); 485 size_t);
474 486
475/* fs/signalfd.c */ 487/* fs/signalfd.c */
@@ -541,7 +553,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags);
541 553
542/* kernel/futex.c */ 554/* kernel/futex.c */
543asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val, 555asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
544 struct timespec __user *utime, u32 __user *uaddr2, 556 struct __kernel_timespec __user *utime, u32 __user *uaddr2,
545 u32 val3); 557 u32 val3);
546asmlinkage long sys_get_robust_list(int pid, 558asmlinkage long sys_get_robust_list(int pid,
547 struct robust_list_head __user * __user *head_ptr, 559 struct robust_list_head __user * __user *head_ptr,
@@ -637,6 +649,10 @@ asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese,
637 siginfo_t __user *uinfo, 649 siginfo_t __user *uinfo,
638 const struct __kernel_timespec __user *uts, 650 const struct __kernel_timespec __user *uts,
639 size_t sigsetsize); 651 size_t sigsetsize);
652asmlinkage long sys_rt_sigtimedwait_time32(const sigset_t __user *uthese,
653 siginfo_t __user *uinfo,
654 const struct old_timespec32 __user *uts,
655 size_t sigsetsize);
640asmlinkage long sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo); 656asmlinkage long sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo);
641 657
642/* kernel/sys.c */ 658/* kernel/sys.c */
@@ -831,6 +847,9 @@ asmlinkage long sys_accept4(int, struct sockaddr __user *, int __user *, int);
831asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg, 847asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg,
832 unsigned int vlen, unsigned flags, 848 unsigned int vlen, unsigned flags,
833 struct __kernel_timespec __user *timeout); 849 struct __kernel_timespec __user *timeout);
850asmlinkage long sys_recvmmsg_time32(int fd, struct mmsghdr __user *msg,
851 unsigned int vlen, unsigned flags,
852 struct old_timespec32 __user *timeout);
834 853
835asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, 854asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr,
836 int options, struct rusage __user *ru); 855 int options, struct rusage __user *ru);
diff --git a/include/linux/time32.h b/include/linux/time32.h
index 61904a6c098f..118b9977080c 100644
--- a/include/linux/time32.h
+++ b/include/linux/time32.h
@@ -96,31 +96,6 @@ static inline int timespec_compare(const struct timespec *lhs, const struct time
96 return lhs->tv_nsec - rhs->tv_nsec; 96 return lhs->tv_nsec - rhs->tv_nsec;
97} 97}
98 98
99extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
100
101static inline struct timespec timespec_add(struct timespec lhs,
102 struct timespec rhs)
103{
104 struct timespec ts_delta;
105
106 set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec,
107 lhs.tv_nsec + rhs.tv_nsec);
108 return ts_delta;
109}
110
111/*
112 * sub = lhs - rhs, in normalized form
113 */
114static inline struct timespec timespec_sub(struct timespec lhs,
115 struct timespec rhs)
116{
117 struct timespec ts_delta;
118
119 set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec,
120 lhs.tv_nsec - rhs.tv_nsec);
121 return ts_delta;
122}
123
124/* 99/*
125 * Returns true if the timespec is norm, false if denorm: 100 * Returns true if the timespec is norm, false if denorm:
126 */ 101 */
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 29975e93fcb8..a8ab0f143ac4 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -262,18 +262,4 @@ void read_persistent_wall_and_boot_offset(struct timespec64 *wall_clock,
262 struct timespec64 *boot_offset); 262 struct timespec64 *boot_offset);
263extern int update_persistent_clock64(struct timespec64 now); 263extern int update_persistent_clock64(struct timespec64 now);
264 264
265/*
266 * deprecated aliases, don't use in new code
267 */
268#define getnstimeofday64(ts) ktime_get_real_ts64(ts)
269
270static inline struct timespec64 current_kernel_time64(void)
271{
272 struct timespec64 ts;
273
274 ktime_get_coarse_real_ts64(&ts);
275
276 return ts;
277}
278
279#endif 265#endif
diff --git a/include/linux/timekeeping32.h b/include/linux/timekeeping32.h
index a502616f7e1c..cc59cc9e0e84 100644
--- a/include/linux/timekeeping32.h
+++ b/include/linux/timekeeping32.h
@@ -6,15 +6,6 @@
6 * over time so we can remove the file here. 6 * over time so we can remove the file here.
7 */ 7 */
8 8
9static inline void do_gettimeofday(struct timeval *tv)
10{
11 struct timespec64 now;
12
13 ktime_get_real_ts64(&now);
14 tv->tv_sec = now.tv_sec;
15 tv->tv_usec = now.tv_nsec/1000;
16}
17
18static inline unsigned long get_seconds(void) 9static inline unsigned long get_seconds(void)
19{ 10{
20 return ktime_get_real_seconds(); 11 return ktime_get_real_seconds();
@@ -52,10 +43,4 @@ static inline void getboottime(struct timespec *ts)
52 *ts = timespec64_to_timespec(ts64); 43 *ts = timespec64_to_timespec(ts64);
53} 44}
54 45
55/*
56 * Persistent clock related interfaces
57 */
58extern void read_persistent_clock(struct timespec *ts);
59extern int update_persistent_clock(struct timespec now);
60
61#endif 46#endif