hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/compat.h
....@@ -7,7 +7,7 @@
77 */
88
99 #include <linux/types.h>
10
-#include <linux/compat_time.h>
10
+#include <linux/time.h>
1111
1212 #include <linux/stat.h>
1313 #include <linux/param.h> /* for HZ */
....@@ -91,6 +91,11 @@
9191 static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
9292 #endif /* COMPAT_SYSCALL_DEFINEx */
9393
94
+struct compat_iovec {
95
+ compat_uptr_t iov_base;
96
+ compat_size_t iov_len;
97
+};
98
+
9499 #ifdef CONFIG_COMPAT
95100
96101 #ifndef compat_user_stack_pointer
....@@ -113,24 +118,10 @@
113118 typedef __compat_uid32_t compat_uid_t;
114119 typedef __compat_gid32_t compat_gid_t;
115120
116
-typedef compat_ulong_t compat_aio_context_t;
117
-
118121 struct compat_sel_arg_struct;
119122 struct rusage;
120123
121
-struct compat_utimbuf {
122
- compat_time_t actime;
123
- compat_time_t modtime;
124
-};
125
-
126
-struct compat_itimerval {
127
- struct compat_timeval it_interval;
128
- struct compat_timeval it_value;
129
-};
130
-
131
-struct itimerval;
132
-int get_compat_itimerval(struct itimerval *, const struct compat_itimerval __user *);
133
-int put_compat_itimerval(struct compat_itimerval __user *, const struct itimerval *);
124
+struct old_itimerval32;
134125
135126 struct compat_tms {
136127 compat_clock_t tms_utime;
....@@ -139,42 +130,14 @@
139130 compat_clock_t tms_cstime;
140131 };
141132
142
-struct compat_timex {
143
- compat_uint_t modes;
144
- compat_long_t offset;
145
- compat_long_t freq;
146
- compat_long_t maxerror;
147
- compat_long_t esterror;
148
- compat_int_t status;
149
- compat_long_t constant;
150
- compat_long_t precision;
151
- compat_long_t tolerance;
152
- struct compat_timeval time;
153
- compat_long_t tick;
154
- compat_long_t ppsfreq;
155
- compat_long_t jitter;
156
- compat_int_t shift;
157
- compat_long_t stabil;
158
- compat_long_t jitcnt;
159
- compat_long_t calcnt;
160
- compat_long_t errcnt;
161
- compat_long_t stbcnt;
162
- compat_int_t tai;
163
-
164
- compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32;
165
- compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32;
166
- compat_int_t:32; compat_int_t:32; compat_int_t:32;
167
-};
168
-
169
-struct timex;
170
-int compat_get_timex(struct timex *, const struct compat_timex __user *);
171
-int compat_put_timex(struct compat_timex __user *, const struct timex *);
172
-
173133 #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
174134
175135 typedef struct {
176136 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
177137 } compat_sigset_t;
138
+
139
+int set_compat_user_sigmask(const compat_sigset_t __user *umask,
140
+ size_t sigsetsize);
178141
179142 struct compat_sigaction {
180143 #ifndef __ARCH_HAS_IRIX_SIGACTION
....@@ -290,28 +253,14 @@
290253 } _sifields;
291254 } compat_siginfo_t;
292255
293
-/*
294
- * These functions operate on 32- or 64-bit specs depending on
295
- * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments.
296
- */
297
-extern int compat_get_timespec(struct timespec *, const void __user *);
298
-extern int compat_put_timespec(const struct timespec *, void __user *);
299
-extern int compat_get_timeval(struct timeval *, const void __user *);
300
-extern int compat_put_timeval(const struct timeval *, void __user *);
301
-
302
-struct compat_iovec {
303
- compat_uptr_t iov_base;
304
- compat_size_t iov_len;
305
-};
306
-
307256 struct compat_rlimit {
308257 compat_ulong_t rlim_cur;
309258 compat_ulong_t rlim_max;
310259 };
311260
312261 struct compat_rusage {
313
- struct compat_timeval ru_utime;
314
- struct compat_timeval ru_stime;
262
+ struct old_timeval32 ru_utime;
263
+ struct old_timeval32 ru_stime;
315264 compat_long_t ru_maxrss;
316265 compat_long_t ru_ixrss;
317266 compat_long_t ru_idrss;
....@@ -453,30 +402,17 @@
453402 unsigned long bitmap_size);
454403 long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
455404 unsigned long bitmap_size);
456
-int copy_siginfo_from_user32(siginfo_t *to, const struct compat_siginfo __user *from);
457
-int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *from);
405
+void copy_siginfo_to_external32(struct compat_siginfo *to,
406
+ const struct kernel_siginfo *from);
407
+int copy_siginfo_from_user32(kernel_siginfo_t *to,
408
+ const struct compat_siginfo __user *from);
409
+int __copy_siginfo_to_user32(struct compat_siginfo __user *to,
410
+ const kernel_siginfo_t *from);
411
+#ifndef copy_siginfo_to_user32
412
+#define copy_siginfo_to_user32 __copy_siginfo_to_user32
413
+#endif
458414 int get_compat_sigevent(struct sigevent *event,
459415 const struct compat_sigevent __user *u_event);
460
-
461
-static inline int compat_timeval_compare(struct compat_timeval *lhs,
462
- struct compat_timeval *rhs)
463
-{
464
- if (lhs->tv_sec < rhs->tv_sec)
465
- return -1;
466
- if (lhs->tv_sec > rhs->tv_sec)
467
- return 1;
468
- return lhs->tv_usec - rhs->tv_usec;
469
-}
470
-
471
-static inline int compat_timespec_compare(struct compat_timespec *lhs,
472
- struct compat_timespec *rhs)
473
-{
474
- if (lhs->tv_sec < rhs->tv_sec)
475
- return -1;
476
- if (lhs->tv_sec > rhs->tv_sec)
477
- return 1;
478
- return lhs->tv_nsec - rhs->tv_nsec;
479
-}
480416
481417 extern int get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat);
482418
....@@ -493,8 +429,11 @@
493429 compat_sigset_t v;
494430 switch (_NSIG_WORDS) {
495431 case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3];
432
+ fallthrough;
496433 case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2];
434
+ fallthrough;
497435 case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1];
436
+ fallthrough;
498437 case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0];
499438 }
500439 return copy_to_user(compat, &v, size) ? -EFAULT : 0;
....@@ -512,22 +451,17 @@
512451
513452 struct epoll_event; /* fortunately, this one is fixed-layout */
514453
515
-extern ssize_t compat_rw_copy_check_uvector(int type,
516
- const struct compat_iovec __user *uvector,
517
- unsigned long nr_segs,
518
- unsigned long fast_segs, struct iovec *fast_pointer,
519
- struct iovec **ret_pointer);
520
-
521454 extern void __user *compat_alloc_user_space(unsigned long len);
522455
523456 int compat_restore_altstack(const compat_stack_t __user *uss);
524457 int __compat_save_altstack(compat_stack_t __user *, unsigned long);
525
-#define compat_save_altstack_ex(uss, sp) do { \
458
+#define unsafe_compat_save_altstack(uss, sp, label) do { \
526459 compat_stack_t __user *__uss = uss; \
527460 struct task_struct *t = current; \
528
- put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \
529
- put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \
530
- put_user_ex(t->sas_ss_size, &__uss->ss_size); \
461
+ unsafe_put_user(ptr_to_compat((void __user *)t->sas_ss_sp), \
462
+ &__uss->ss_sp, label); \
463
+ unsafe_put_user(t->sas_ss_flags, &__uss->ss_flags, label); \
464
+ unsafe_put_user(t->sas_ss_size, &__uss->ss_size, label); \
531465 if (t->sas_ss_flags & SS_AUTODISARM) \
532466 sas_ss_reset(t); \
533467 } while (0);
....@@ -549,16 +483,17 @@
549483 asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p);
550484 asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr,
551485 u32 __user *iocb);
552
-asmlinkage long compat_sys_io_getevents(compat_aio_context_t ctx_id,
553
- compat_long_t min_nr,
554
- compat_long_t nr,
555
- struct io_event __user *events,
556
- struct compat_timespec __user *timeout);
557486 asmlinkage long compat_sys_io_pgetevents(compat_aio_context_t ctx_id,
558487 compat_long_t min_nr,
559488 compat_long_t nr,
560489 struct io_event __user *events,
561
- struct compat_timespec __user *timeout,
490
+ struct old_timespec32 __user *timeout,
491
+ const struct __compat_aio_sigset __user *usig);
492
+asmlinkage long compat_sys_io_pgetevents_time64(compat_aio_context_t ctx_id,
493
+ compat_long_t min_nr,
494
+ compat_long_t nr,
495
+ struct io_event __user *events,
496
+ struct __kernel_timespec __user *timeout,
562497 const struct __compat_aio_sigset __user *usig);
563498
564499 /* fs/cookies.c */
....@@ -580,12 +515,6 @@
580515 /* fs/ioctl.c */
581516 asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
582517 compat_ulong_t arg);
583
-
584
-/* fs/namespace.c */
585
-asmlinkage long compat_sys_mount(const char __user *dev_name,
586
- const char __user *dir_name,
587
- const char __user *type, compat_ulong_t flags,
588
- const void __user *data);
589518
590519 /* fs/open.c */
591520 asmlinkage long compat_sys_statfs(const char __user *pathname,
....@@ -610,26 +539,22 @@
610539
611540 /* fs/read_write.c */
612541 asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int);
613
-asmlinkage ssize_t compat_sys_readv(compat_ulong_t fd,
614
- const struct compat_iovec __user *vec, compat_ulong_t vlen);
615
-asmlinkage ssize_t compat_sys_writev(compat_ulong_t fd,
616
- const struct compat_iovec __user *vec, compat_ulong_t vlen);
617542 /* No generic prototype for pread64 and pwrite64 */
618543 asmlinkage ssize_t compat_sys_preadv(compat_ulong_t fd,
619
- const struct compat_iovec __user *vec,
544
+ const struct iovec __user *vec,
620545 compat_ulong_t vlen, u32 pos_low, u32 pos_high);
621546 asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd,
622
- const struct compat_iovec __user *vec,
547
+ const struct iovec __user *vec,
623548 compat_ulong_t vlen, u32 pos_low, u32 pos_high);
624549 #ifdef __ARCH_WANT_COMPAT_SYS_PREADV64
625550 asmlinkage long compat_sys_preadv64(unsigned long fd,
626
- const struct compat_iovec __user *vec,
551
+ const struct iovec __user *vec,
627552 unsigned long vlen, loff_t pos);
628553 #endif
629554
630555 #ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64
631556 asmlinkage long compat_sys_pwritev64(unsigned long fd,
632
- const struct compat_iovec __user *vec,
557
+ const struct iovec __user *vec,
633558 unsigned long vlen, loff_t pos);
634559 #endif
635560
....@@ -640,14 +565,24 @@
640565 compat_loff_t __user *offset, compat_size_t count);
641566
642567 /* fs/select.c */
643
-asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
568
+asmlinkage long compat_sys_pselect6_time32(int n, compat_ulong_t __user *inp,
644569 compat_ulong_t __user *outp,
645570 compat_ulong_t __user *exp,
646
- struct compat_timespec __user *tsp,
571
+ struct old_timespec32 __user *tsp,
647572 void __user *sig);
648
-asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
573
+asmlinkage long compat_sys_pselect6_time64(int n, compat_ulong_t __user *inp,
574
+ compat_ulong_t __user *outp,
575
+ compat_ulong_t __user *exp,
576
+ struct __kernel_timespec __user *tsp,
577
+ void __user *sig);
578
+asmlinkage long compat_sys_ppoll_time32(struct pollfd __user *ufds,
649579 unsigned int nfds,
650
- struct compat_timespec __user *tsp,
580
+ struct old_timespec32 __user *tsp,
581
+ const compat_sigset_t __user *sigmask,
582
+ compat_size_t sigsetsize);
583
+asmlinkage long compat_sys_ppoll_time64(struct pollfd __user *ufds,
584
+ unsigned int nfds,
585
+ struct __kernel_timespec __user *tsp,
651586 const compat_sigset_t __user *sigmask,
652587 compat_size_t sigsetsize);
653588
....@@ -655,10 +590,6 @@
655590 asmlinkage long compat_sys_signalfd4(int ufd,
656591 const compat_sigset_t __user *sigmask,
657592 compat_size_t sigsetsize, int flags);
658
-
659
-/* fs/splice.c */
660
-asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
661
- unsigned int nr_segs, unsigned int flags);
662593
663594 /* fs/stat.c */
664595 asmlinkage long compat_sys_newfstatat(unsigned int dfd,
....@@ -670,19 +601,6 @@
670601
671602 /* fs/sync.c: No generic prototype for sync_file_range and sync_file_range2 */
672603
673
-/* fs/timerfd.c */
674
-asmlinkage long compat_sys_timerfd_gettime(int ufd,
675
- struct compat_itimerspec __user *otmr);
676
-asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
677
- const struct compat_itimerspec __user *utmr,
678
- struct compat_itimerspec __user *otmr);
679
-
680
-/* fs/utimes.c */
681
-asmlinkage long compat_sys_utimensat(unsigned int dfd,
682
- const char __user *filename,
683
- struct compat_timespec __user *t,
684
- int flags);
685
-
686604 /* kernel/exit.c */
687605 asmlinkage long compat_sys_waitid(int, compat_pid_t,
688606 struct compat_siginfo __user *, int,
....@@ -691,9 +609,6 @@
691609
692610
693611 /* kernel/futex.c */
694
-asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
695
- struct compat_timespec __user *utime, u32 __user *uaddr2,
696
- u32 val3);
697612 asmlinkage long
698613 compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
699614 compat_size_t len);
....@@ -701,16 +616,12 @@
701616 compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
702617 compat_size_t __user *len_ptr);
703618
704
-/* kernel/hrtimer.c */
705
-asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
706
- struct compat_timespec __user *rmtp);
707
-
708619 /* kernel/itimer.c */
709620 asmlinkage long compat_sys_getitimer(int which,
710
- struct compat_itimerval __user *it);
621
+ struct old_itimerval32 __user *it);
711622 asmlinkage long compat_sys_setitimer(int which,
712
- struct compat_itimerval __user *in,
713
- struct compat_itimerval __user *out);
623
+ struct old_itimerval32 __user *in,
624
+ struct old_itimerval32 __user *out);
714625
715626 /* kernel/kexec.c */
716627 asmlinkage long compat_sys_kexec_load(compat_ulong_t entry,
....@@ -722,20 +633,6 @@
722633 asmlinkage long compat_sys_timer_create(clockid_t which_clock,
723634 struct compat_sigevent __user *timer_event_spec,
724635 timer_t __user *created_timer_id);
725
-asmlinkage long compat_sys_timer_gettime(timer_t timer_id,
726
- struct compat_itimerspec __user *setting);
727
-asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags,
728
- struct compat_itimerspec __user *new,
729
- struct compat_itimerspec __user *old);
730
-asmlinkage long compat_sys_clock_settime(clockid_t which_clock,
731
- struct compat_timespec __user *tp);
732
-asmlinkage long compat_sys_clock_gettime(clockid_t which_clock,
733
- struct compat_timespec __user *tp);
734
-asmlinkage long compat_sys_clock_getres(clockid_t which_clock,
735
- struct compat_timespec __user *tp);
736
-asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
737
- struct compat_timespec __user *rqtp,
738
- struct compat_timespec __user *rmtp);
739636
740637 /* kernel/ptrace.c */
741638 asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
....@@ -748,8 +645,6 @@
748645 asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid,
749646 unsigned int len,
750647 compat_ulong_t __user *user_mask_ptr);
751
-asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
752
- struct compat_timespec __user *interval);
753648
754649 /* kernel/signal.c */
755650 asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
....@@ -767,9 +662,12 @@
767662 compat_size_t sigsetsize);
768663 asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
769664 compat_size_t sigsetsize);
770
-asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
665
+asmlinkage long compat_sys_rt_sigtimedwait_time32(compat_sigset_t __user *uthese,
771666 struct compat_siginfo __user *uinfo,
772
- struct compat_timespec __user *uts, compat_size_t sigsetsize);
667
+ struct old_timespec32 __user *uts, compat_size_t sigsetsize);
668
+asmlinkage long compat_sys_rt_sigtimedwait_time64(compat_sigset_t __user *uthese,
669
+ struct compat_siginfo __user *uinfo,
670
+ struct __kernel_timespec __user *uts, compat_size_t sigsetsize);
773671 asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
774672 struct compat_siginfo __user *uinfo);
775673 /* No generic prototype for rt_sigreturn */
....@@ -783,11 +681,10 @@
783681 asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru);
784682
785683 /* kernel/time.c */
786
-asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
684
+asmlinkage long compat_sys_gettimeofday(struct old_timeval32 __user *tv,
787685 struct timezone __user *tz);
788
-asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
686
+asmlinkage long compat_sys_settimeofday(struct old_timeval32 __user *tv,
789687 struct timezone __user *tz);
790
-asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
791688
792689 /* kernel/timer.c */
793690 asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
....@@ -796,14 +693,6 @@
796693 asmlinkage long compat_sys_mq_open(const char __user *u_name,
797694 int oflag, compat_mode_t mode,
798695 struct compat_mq_attr __user *u_attr);
799
-asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes,
800
- const char __user *u_msg_ptr,
801
- compat_size_t msg_len, unsigned int msg_prio,
802
- const struct compat_timespec __user *u_abs_timeout);
803
-asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
804
- char __user *u_msg_ptr,
805
- compat_size_t msg_len, unsigned int __user *u_msg_prio,
806
- const struct compat_timespec __user *u_abs_timeout);
807696 asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
808697 const struct compat_sigevent __user *u_notification);
809698 asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
....@@ -819,8 +708,6 @@
819708
820709 /* ipc/sem.c */
821710 asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
822
-asmlinkage long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
823
- unsigned nsems, const struct compat_timespec __user *timeout);
824711
825712 /* ipc/shm.c */
826713 asmlinkage long compat_sys_shmctl(int first, int second, void __user *uptr);
....@@ -830,10 +717,6 @@
830717 asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, compat_size_t len,
831718 unsigned flags, struct sockaddr __user *addr,
832719 int __user *addrlen);
833
-asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
834
- char __user *optval, unsigned int optlen);
835
-asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
836
- char __user *optval, int __user *optlen);
837720 asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg,
838721 unsigned flags);
839722 asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg,
....@@ -875,9 +758,12 @@
875758 asmlinkage long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid,
876759 compat_pid_t pid, int sig,
877760 struct compat_siginfo __user *uinfo);
878
-asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
761
+asmlinkage long compat_sys_recvmmsg_time64(int fd, struct compat_mmsghdr __user *mmsg,
879762 unsigned vlen, unsigned int flags,
880
- struct compat_timespec __user *timeout);
763
+ struct __kernel_timespec __user *timeout);
764
+asmlinkage long compat_sys_recvmmsg_time32(int fd, struct compat_mmsghdr __user *mmsg,
765
+ unsigned vlen, unsigned int flags,
766
+ struct old_timespec32 __user *timeout);
881767 asmlinkage long compat_sys_wait4(compat_pid_t pid,
882768 compat_uint_t __user *stat_addr, int options,
883769 struct compat_rusage __user *ru);
....@@ -886,36 +772,26 @@
886772 asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
887773 struct file_handle __user *handle,
888774 int flags);
889
-asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock,
890
- struct compat_timex __user *tp);
891775 asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
892776 unsigned vlen, unsigned int flags);
893
-asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
894
- const struct compat_iovec __user *lvec,
895
- compat_ulong_t liovcnt, const struct compat_iovec __user *rvec,
896
- compat_ulong_t riovcnt, compat_ulong_t flags);
897
-asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
898
- const struct compat_iovec __user *lvec,
899
- compat_ulong_t liovcnt, const struct compat_iovec __user *rvec,
900
- compat_ulong_t riovcnt, compat_ulong_t flags);
901777 asmlinkage long compat_sys_execveat(int dfd, const char __user *filename,
902778 const compat_uptr_t __user *argv,
903779 const compat_uptr_t __user *envp, int flags);
904780 asmlinkage ssize_t compat_sys_preadv2(compat_ulong_t fd,
905
- const struct compat_iovec __user *vec,
781
+ const struct iovec __user *vec,
906782 compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
907783 asmlinkage ssize_t compat_sys_pwritev2(compat_ulong_t fd,
908
- const struct compat_iovec __user *vec,
784
+ const struct iovec __user *vec,
909785 compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
910786 #ifdef __ARCH_WANT_COMPAT_SYS_PREADV64V2
911
-asmlinkage long compat_sys_readv64v2(unsigned long fd,
912
- const struct compat_iovec __user *vec,
787
+asmlinkage long compat_sys_preadv64v2(unsigned long fd,
788
+ const struct iovec __user *vec,
913789 unsigned long vlen, loff_t pos, rwf_t flags);
914790 #endif
915791
916792 #ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64V2
917793 asmlinkage long compat_sys_pwritev64v2(unsigned long fd,
918
- const struct compat_iovec __user *vec,
794
+ const struct iovec __user *vec,
919795 unsigned long vlen, loff_t pos, rwf_t flags);
920796 #endif
921797
....@@ -928,8 +804,6 @@
928804 /* __ARCH_WANT_SYSCALL_NO_AT */
929805 asmlinkage long compat_sys_open(const char __user *filename, int flags,
930806 umode_t mode);
931
-asmlinkage long compat_sys_utimes(const char __user *filename,
932
- struct compat_timeval __user *t);
933807
934808 /* __ARCH_WANT_SYSCALL_NO_FLAGS */
935809 asmlinkage long compat_sys_signalfd(int ufd,
....@@ -943,19 +817,12 @@
943817 struct compat_stat __user *statbuf);
944818
945819 /* __ARCH_WANT_SYSCALL_DEPRECATED */
946
-asmlinkage long compat_sys_time(compat_time_t __user *tloc);
947
-asmlinkage long compat_sys_utime(const char __user *filename,
948
- struct compat_utimbuf __user *t);
949
-asmlinkage long compat_sys_futimesat(unsigned int dfd,
950
- const char __user *filename,
951
- struct compat_timeval __user *t);
952820 asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
953821 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
954
- struct compat_timeval __user *tvp);
822
+ struct old_timeval32 __user *tvp);
955823 asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32);
956824 asmlinkage long compat_sys_recv(int fd, void __user *buf, compat_size_t len,
957825 unsigned flags);
958
-asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args);
959826
960827 /* obsolete: fs/readdir.c */
961828 asmlinkage long compat_sys_old_readdir(unsigned int fd,
....@@ -983,9 +850,6 @@
983850 struct compat_old_sigaction __user *oact);
984851 #endif
985852
986
-/* obsolete: kernel/time/time.c */
987
-asmlinkage long compat_sys_stime(compat_time_t __user *tptr);
988
-
989853 /* obsolete: net/socket.c */
990854 asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
991855
....@@ -1003,17 +867,17 @@
1003867 #endif
1004868
1005869 /**
1006
- * ns_to_compat_timeval - Compat version of ns_to_timeval
870
+ * ns_to_old_timeval32 - Compat version of ns_to_timeval
1007871 * @nsec: the nanoseconds value to be converted
1008872 *
1009
- * Returns the compat_timeval representation of the nsec parameter.
873
+ * Returns the old_timeval32 representation of the nsec parameter.
1010874 */
1011
-static inline struct compat_timeval ns_to_compat_timeval(s64 nsec)
875
+static inline struct old_timeval32 ns_to_old_timeval32(s64 nsec)
1012876 {
1013
- struct timeval tv;
1014
- struct compat_timeval ctv;
877
+ struct __kernel_old_timeval tv;
878
+ struct old_timeval32 ctv;
1015879
1016
- tv = ns_to_timeval(nsec);
880
+ tv = ns_to_kernel_old_timeval(nsec);
1017881 ctv.tv_sec = tv.tv_sec;
1018882 ctv.tv_usec = tv.tv_usec;
1019883
....@@ -1034,10 +898,37 @@
1034898 #else /* !CONFIG_COMPAT */
1035899
1036900 #define is_compat_task() (0)
1037
-#ifndef in_compat_syscall
901
+/* Ensure no one redefines in_compat_syscall() under !CONFIG_COMPAT */
902
+#define in_compat_syscall in_compat_syscall
1038903 static inline bool in_compat_syscall(void) { return false; }
1039
-#endif
1040904
1041905 #endif /* CONFIG_COMPAT */
1042906
907
+/*
908
+ * Some legacy ABIs like the i386 one use less than natural alignment for 64-bit
909
+ * types, and will need special compat treatment for that. Most architectures
910
+ * don't need that special handling even for compat syscalls.
911
+ */
912
+#ifndef compat_need_64bit_alignment_fixup
913
+#define compat_need_64bit_alignment_fixup() false
914
+#endif
915
+
916
+/*
917
+ * A pointer passed in from user mode. This should not
918
+ * be used for syscall parameters, just declare them
919
+ * as pointers because the syscall entry code will have
920
+ * appropriately converted them already.
921
+ */
922
+#ifndef compat_ptr
923
+static inline void __user *compat_ptr(compat_uptr_t uptr)
924
+{
925
+ return (void __user *)(unsigned long)uptr;
926
+}
927
+#endif
928
+
929
+static inline compat_uptr_t ptr_to_compat(void __user *uptr)
930
+{
931
+ return (u32)(unsigned long)uptr;
932
+}
933
+
1043934 #endif /* _LINUX_COMPAT_H */