History

y2038: syscalls: rename y2038 compat syscalls

A lot of system calls that pass a time_t somewhere have an implementation using a COMPAT_SYSCALL_DEFINEx() on 64-bit architectures, and have been reworked so that this implementation can now be used on 32-bit architectures as well. The missing step is to redefine them using the regular SYSCALL_DEFINEx() to get them out of the compat namespace and make it possible to build them on 32-bit architectures. Any system call that ends in 'time' gets a '32' suffix on its name for that version, while the others get a '_time32' suffix, to distinguish them from the normal version, which takes a 64-bit time argument in the future. In this step, only 64-bit architectures are changed, doing this rename first lets us avoid touching the 32-bit architectures twice.

Arnd Bergmann committed 7 years ago

Commit 8dabe721 parent 794845026 files · +361 −367Browse files

Showing the changes to include/linux (2 of 26 files). Show all

Unified · Split

2 files
  1. include/linux/compat.h +4 −69
  2. include/linux/syscalls.h +57 −0
include/linux/compat.h+4−69
@@ -520,11 +520,6 @@ int __compat_save_altstack(compat_stack_t __user *, unsigned long); · 519 unmodified lines
520520 asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p);
521521 asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr,
522522 u32 __user *iocb);
523−asmlinkage long compat_sys_io_getevents(compat_aio_context_t ctx_id,
524− compat_long_t min_nr,
525− compat_long_t nr,
526− struct io_event __user *events,
527− struct old_timespec32 __user *timeout);
528523 asmlinkage long compat_sys_io_pgetevents(compat_aio_context_t ctx_id,
529524 compat_long_t min_nr,
530525 compat_long_t nr,
@@ -617,7 +612,7 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, · 86 unmodified lines
617612 compat_loff_t __user *offset, compat_size_t count);
618613
619614 /* fs/select.c */
620−asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
615+asmlinkage long compat_sys_pselect6_time32(int n, compat_ulong_t __user *inp,
621616 compat_ulong_t __user *outp,
622617 compat_ulong_t __user *exp,
623618 struct old_timespec32 __user *tsp,
@@ -627,7 +622,7 @@ asmlinkage long compat_sys_pselect6_time64(int n, compat_ulong_t __user *inp, · 3 unmodified lines
627622 compat_ulong_t __user *exp,
628623 struct __kernel_timespec __user *tsp,
629624 void __user *sig);
630−asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
625+asmlinkage long compat_sys_ppoll_time32(struct pollfd __user *ufds,
631626 unsigned int nfds,
632627 struct old_timespec32 __user *tsp,
633628 const compat_sigset_t __user *sigmask,
@@ -657,19 +652,6 @@ asmlinkage long compat_sys_newfstat(unsigned int fd, · 23 unmodified lines
657652
658653 /* fs/sync.c: No generic prototype for sync_file_range and sync_file_range2 */
659654
660−/* fs/timerfd.c */
661−asmlinkage long compat_sys_timerfd_gettime(int ufd,
662− struct old_itimerspec32 __user *otmr);
663−asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
664− const struct old_itimerspec32 __user *utmr,
665− struct old_itimerspec32 __user *otmr);
666−
667−/* fs/utimes.c */
668−asmlinkage long compat_sys_utimensat(unsigned int dfd,
669− const char __user *filename,
670− struct old_timespec32 __user *t,
671− int flags);
672−
673655 /* kernel/exit.c */
674656 asmlinkage long compat_sys_waitid(int, compat_pid_t,
675657 struct compat_siginfo __user *, int,
@@ -678,9 +660,6 @@ asmlinkage long compat_sys_waitid(int, compat_pid_t, · 2 unmodified lines
678660
679661
680662 /* kernel/futex.c */
681−asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
682− struct old_timespec32 __user *utime, u32 __user *uaddr2,
683− u32 val3);
684663 asmlinkage long
685664 compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
686665 compat_size_t len);
@@ -688,10 +667,6 @@ asmlinkage long · 1 unmodified line
688667 compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
689668 compat_size_t __user *len_ptr);
690669
691−/* kernel/hrtimer.c */
692−asmlinkage long compat_sys_nanosleep(struct old_timespec32 __user *rqtp,
693− struct old_timespec32 __user *rmtp);
694−
695670 /* kernel/itimer.c */
696671 asmlinkage long compat_sys_getitimer(int which,
697672 struct compat_itimerval __user *it);
@@ -709,20 +684,6 @@ asmlinkage long compat_sys_kexec_load(compat_ulong_t entry, · 11 unmodified lines
709684 asmlinkage long compat_sys_timer_create(clockid_t which_clock,
710685 struct compat_sigevent __user *timer_event_spec,
711686 timer_t __user *created_timer_id);
712−asmlinkage long compat_sys_timer_gettime(timer_t timer_id,
713− struct old_itimerspec32 __user *setting);
714−asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags,
715− struct old_itimerspec32 __user *new,
716− struct old_itimerspec32 __user *old);
717−asmlinkage long compat_sys_clock_settime(clockid_t which_clock,
718− struct old_timespec32 __user *tp);
719−asmlinkage long compat_sys_clock_gettime(clockid_t which_clock,
720− struct old_timespec32 __user *tp);
721−asmlinkage long compat_sys_clock_getres(clockid_t which_clock,
722− struct old_timespec32 __user *tp);
723−asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
724− struct old_timespec32 __user *rqtp,
725− struct old_timespec32 __user *rmtp);
726687
727688 /* kernel/ptrace.c */
728689 asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
@@ -735,8 +696,6 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, · 6 unmodified lines
735696 asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid,
736697 unsigned int len,
737698 compat_ulong_t __user *user_mask_ptr);
738−asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
739− struct old_timespec32 __user *interval);
740699
741700 /* kernel/signal.c */
742701 asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
@@ -754,7 +713,7 @@ asmlinkage long compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set, · 11 unmodified lines
754713 compat_size_t sigsetsize);
755714 asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
756715 compat_size_t sigsetsize);
757−asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
716+asmlinkage long compat_sys_rt_sigtimedwait_time32(compat_sigset_t __user *uthese,
758717 struct compat_siginfo __user *uinfo,
759718 struct old_timespec32 __user *uts, compat_size_t sigsetsize);
760719 asmlinkage long compat_sys_rt_sigtimedwait_time64(compat_sigset_t __user *uthese,
@@ -777,7 +736,6 @@ asmlinkage long compat_sys_gettimeofday(struct old_timeval32 __user *tv, · 16 unmodified lines
777736 struct timezone __user *tz);
778737 asmlinkage long compat_sys_settimeofday(struct old_timeval32 __user *tv,
779738 struct timezone __user *tz);
780−asmlinkage long compat_sys_adjtimex(struct old_timex32 __user *utp);
781739
782740 /* kernel/timer.c */
783741 asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
@@ -786,14 +744,6 @@ asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info); · 2 unmodified lines
786744 asmlinkage long compat_sys_mq_open(const char __user *u_name,
787745 int oflag, compat_mode_t mode,
788746 struct compat_mq_attr __user *u_attr);
789−asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes,
790− const char __user *u_msg_ptr,
791− compat_size_t msg_len, unsigned int msg_prio,
792− const struct old_timespec32 __user *u_abs_timeout);
793−asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
794− char __user *u_msg_ptr,
795− compat_size_t msg_len, unsigned int __user *u_msg_prio,
796− const struct old_timespec32 __user *u_abs_timeout);
797747 asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
798748 const struct compat_sigevent __user *u_notification);
799749 asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
@@ -809,8 +759,6 @@ asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp, · 9 unmodified lines
809759
810760 /* ipc/sem.c */
811761 asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
812−asmlinkage long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
813− unsigned nsems, const struct old_timespec32 __user *timeout);
814762
815763 /* ipc/shm.c */
816764 asmlinkage long compat_sys_shmctl(int first, int second, void __user *uptr);
@@ -868,7 +816,7 @@ asmlinkage long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, · 51 unmodified lines
868816 asmlinkage long compat_sys_recvmmsg_time64(int fd, struct compat_mmsghdr __user *mmsg,
869817 unsigned vlen, unsigned int flags,
870818 struct __kernel_timespec __user *timeout);
871−asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
819+asmlinkage long compat_sys_recvmmsg_time32(int fd, struct compat_mmsghdr __user *mmsg,
872820 unsigned vlen, unsigned int flags,
873821 struct old_timespec32 __user *timeout);
874822 asmlinkage long compat_sys_wait4(compat_pid_t pid,
@@ -879,8 +827,6 @@ asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32, · 4 unmodified lines
879827 asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
880828 struct file_handle __user *handle,
881829 int flags);
882−asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock,
883− struct old_timex32 __user *tp);
884830 asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
885831 unsigned vlen, unsigned int flags);
886832 asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
@@ -921,8 +867,6 @@ asmlinkage long compat_sys_pwritev64v2(unsigned long fd, · 34 unmodified lines
921867 /* __ARCH_WANT_SYSCALL_NO_AT */
922868 asmlinkage long compat_sys_open(const char __user *filename, int flags,
923869 umode_t mode);
924−asmlinkage long compat_sys_utimes(const char __user *filename,
925− struct old_timeval32 __user *t);
926870
927871 /* __ARCH_WANT_SYSCALL_NO_FLAGS */
928872 asmlinkage long compat_sys_signalfd(int ufd,
@@ -936,12 +880,6 @@ asmlinkage long compat_sys_newlstat(const char __user *filename, · 7 unmodified lines
936880 struct compat_stat __user *statbuf);
937881
938882 /* __ARCH_WANT_SYSCALL_DEPRECATED */
939−asmlinkage long compat_sys_time(old_time32_t __user *tloc);
940−asmlinkage long compat_sys_utime(const char __user *filename,
941− struct old_utimbuf32 __user *t);
942−asmlinkage long compat_sys_futimesat(unsigned int dfd,
943− const char __user *filename,
944− struct old_timeval32 __user *t);
945883 asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
946884 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
947885 struct old_timeval32 __user *tvp);
@@ -976,9 +914,6 @@ asmlinkage long compat_sys_sigaction(int sig, · 28 unmodified lines
976914 struct compat_old_sigaction __user *oact);
977915 #endif
978916
979−/* obsolete: kernel/time/time.c */
980−asmlinkage long compat_sys_stime(old_time32_t __user *tptr);
981−
982917 /* obsolete: net/socket.c */
983918 asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
984919
include/linux/syscalls.h+57−0
@@ -297,6 +297,11 @@ asmlinkage long sys_io_getevents(aio_context_t ctx_id, · 296 unmodified lines
297297 long nr,
298298 struct io_event __user *events,
299299 struct __kernel_timespec __user *timeout);
300+asmlinkage long sys_io_getevents_time32(__u32 ctx_id,
301+ __s32 min_nr,
302+ __s32 nr,
303+ struct io_event __user *events,
304+ struct old_timespec32 __user *timeout);
300305 asmlinkage long sys_io_pgetevents(aio_context_t ctx_id,
301306 long min_nr,
302307 long nr,
@@ -522,11 +527,19 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags, · 219 unmodified lines
522527 const struct __kernel_itimerspec __user *utmr,
523528 struct __kernel_itimerspec __user *otmr);
524529 asmlinkage long sys_timerfd_gettime(int ufd, struct __kernel_itimerspec __user *otmr);
530+asmlinkage long sys_timerfd_gettime32(int ufd,
531+ struct old_itimerspec32 __user *otmr);
532+asmlinkage long sys_timerfd_settime32(int ufd, int flags,
533+ const struct old_itimerspec32 __user *utmr,
534+ struct old_itimerspec32 __user *otmr);
525535
526536 /* fs/utimes.c */
527537 asmlinkage long sys_utimensat(int dfd, const char __user *filename,
528538 struct __kernel_timespec __user *utimes,
529539 int flags);
540+asmlinkage long sys_utimensat_time32(unsigned int dfd,
541+ const char __user *filename,
542+ struct old_timespec32 __user *t, int flags);
530543
531544 /* kernel/acct.c */
532545 asmlinkage long sys_acct(const char __user *name);
@@ -555,6 +568,9 @@ asmlinkage long sys_unshare(unsigned long unshare_flags); · 22 unmodified lines
555568 asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
556569 struct __kernel_timespec __user *utime, u32 __user *uaddr2,
557570 u32 val3);
571+asmlinkage long sys_futex_time32(u32 __user *uaddr, int op, u32 val,
572+ struct old_timespec32 __user *utime, u32 __user *uaddr2,
573+ u32 val3);
558574 asmlinkage long sys_get_robust_list(int pid,
559575 struct robust_list_head __user * __user *head_ptr,
560576 size_t __user *len_ptr);
@@ -564,6 +580,8 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, · 3 unmodified lines
564580 /* kernel/hrtimer.c */
565581 asmlinkage long sys_nanosleep(struct __kernel_timespec __user *rqtp,
566582 struct __kernel_timespec __user *rmtp);
583+asmlinkage long sys_nanosleep_time32(struct old_timespec32 __user *rqtp,
584+ struct old_timespec32 __user *rmtp);
567585
568586 /* kernel/itimer.c */
569587 asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
@@ -602,6 +620,20 @@ asmlinkage long sys_clock_getres(clockid_t which_clock, · 32 unmodified lines
602620 asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags,
603621 const struct __kernel_timespec __user *rqtp,
604622 struct __kernel_timespec __user *rmtp);
623+asmlinkage long sys_timer_gettime32(timer_t timer_id,
624+ struct old_itimerspec32 __user *setting);
625+asmlinkage long sys_timer_settime32(timer_t timer_id, int flags,
626+ struct old_itimerspec32 __user *new,
627+ struct old_itimerspec32 __user *old);
628+asmlinkage long sys_clock_settime32(clockid_t which_clock,
629+ struct old_timespec32 __user *tp);
630+asmlinkage long sys_clock_gettime32(clockid_t which_clock,
631+ struct old_timespec32 __user *tp);
632+asmlinkage long sys_clock_getres_time32(clockid_t which_clock,
633+ struct old_timespec32 __user *tp);
634+asmlinkage long sys_clock_nanosleep_time32(clockid_t which_clock, int flags,
635+ struct old_timespec32 __user *rqtp,
636+ struct old_timespec32 __user *rmtp);
605637
606638 /* kernel/printk.c */
607639 asmlinkage long sys_syslog(int type, char __user *buf, int len);
@@ -627,6 +659,8 @@ asmlinkage long sys_sched_get_priority_max(int policy); · 19 unmodified lines
627659 asmlinkage long sys_sched_get_priority_min(int policy);
628660 asmlinkage long sys_sched_rr_get_interval(pid_t pid,
629661 struct __kernel_timespec __user *interval);
662+asmlinkage long sys_sched_rr_get_interval_time32(pid_t pid,
663+ struct old_timespec32 __user *interval);
630664
631665 /* kernel/signal.c */
632666 asmlinkage long sys_restart_syscall(void);
@@ -696,6 +730,7 @@ asmlinkage long sys_gettimeofday(struct timeval __user *tv, · 63 unmodified lines
696730 asmlinkage long sys_settimeofday(struct timeval __user *tv,
697731 struct timezone __user *tz);
698732 asmlinkage long sys_adjtimex(struct __kernel_timex __user *txc_p);
733+asmlinkage long sys_adjtimex_time32(struct old_timex32 __user *txc_p);
699734
700735 /* kernel/timer.c */
701736 asmlinkage long sys_getpid(void);
@@ -714,6 +749,14 @@ asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t · 12 unmodified lines
714749 asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct __kernel_timespec __user *abs_timeout);
715750 asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
716751 asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
752+asmlinkage long sys_mq_timedreceive_time32(mqd_t mqdes,
753+ char __user *u_msg_ptr,
754+ unsigned int msg_len, unsigned int __user *u_msg_prio,
755+ const struct old_timespec32 __user *u_abs_timeout);
756+asmlinkage long sys_mq_timedsend_time32(mqd_t mqdes,
757+ const char __user *u_msg_ptr,
758+ unsigned int msg_len, unsigned int msg_prio,
759+ const struct old_timespec32 __user *u_abs_timeout);
717760
718761 /* ipc/msg.c */
719762 asmlinkage long sys_msgget(key_t key, int msgflg);
@@ -731,6 +774,9 @@ asmlinkage long sys_old_semctl(int semid, int semnum, int cmd, unsigned long arg · 11 unmodified lines
731774 asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
732775 unsigned nsops,
733776 const struct __kernel_timespec __user *timeout);
777+asmlinkage long sys_semtimedop_time32(int semid, struct sembuf __user *sops,
778+ unsigned nsops,
779+ const struct old_timespec32 __user *timeout);
734780 asmlinkage long sys_semop(int semid, struct sembuf __user *sops,
735781 unsigned nsops);
736782
@@ -871,6 +917,8 @@ asmlinkage long sys_open_by_handle_at(int mountdirfd, · 134 unmodified lines
871917 int flags);
872918 asmlinkage long sys_clock_adjtime(clockid_t which_clock,
873919 struct __kernel_timex __user *tx);
920+asmlinkage long sys_clock_adjtime32(clockid_t which_clock,
921+ struct old_timex32 __user *tx);
874922 asmlinkage long sys_syncfs(int fd);
875923 asmlinkage long sys_setns(int fd, int nstype);
876924 asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
@@ -1006,6 +1054,7 @@ asmlinkage long sys_alarm(unsigned int seconds); · 129 unmodified lines
10061054 asmlinkage long sys_getpgrp(void);
10071055 asmlinkage long sys_pause(void);
10081056 asmlinkage long sys_time(time_t __user *tloc);
1057+asmlinkage long sys_time32(old_time32_t __user *tloc);
10091058 #ifdef __ARCH_WANT_SYS_UTIME
10101059 asmlinkage long sys_utime(char __user *filename,
10111060 struct utimbuf __user *times);
@@ -1014,6 +1063,13 @@ asmlinkage long sys_utimes(char __user *filename, · 2 unmodified lines
10141063 asmlinkage long sys_futimesat(int dfd, const char __user *filename,
10151064 struct timeval __user *utimes);
10161065 #endif
1066+asmlinkage long sys_futimesat_time32(unsigned int dfd,
1067+ const char __user *filename,
1068+ struct old_timeval32 __user *t);
1069+asmlinkage long sys_utime32(const char __user *filename,
1070+ struct old_utimbuf32 __user *t);
1071+asmlinkage long sys_utimes_time32(const char __user *filename,
1072+ struct old_timeval32 __user *t);
10171073 asmlinkage long sys_creat(const char __user *pathname, umode_t mode);
10181074 asmlinkage long sys_getdents(unsigned int fd,
10191075 struct linux_dirent __user *dirent,
@@ -1038,6 +1094,7 @@ asmlinkage long sys_fork(void); · 18 unmodified lines
10381094
10391095 /* obsolete: kernel/time/time.c */
10401096 asmlinkage long sys_stime(time_t __user *tptr);
1097+asmlinkage long sys_stime32(old_time32_t __user *tptr);
10411098
10421099 /* obsolete: kernel/signal.c */
10431100 asmlinkage long sys_sigpending(old_sigset_t __user *uset);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t