diff options
Diffstat (limited to 'include/linux/compat.h')
| -rw-r--r-- | include/linux/compat.h | 236 |
1 files changed, 216 insertions, 20 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h index 5778b559d59c..ddcb7db38e67 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
| @@ -12,6 +12,8 @@ | |||
| 12 | #include <linux/sem.h> | 12 | #include <linux/sem.h> |
| 13 | #include <linux/socket.h> | 13 | #include <linux/socket.h> |
| 14 | #include <linux/if.h> | 14 | #include <linux/if.h> |
| 15 | #include <linux/fs.h> | ||
| 16 | #include <linux/aio_abi.h> /* for aio_context_t */ | ||
| 15 | 17 | ||
| 16 | #include <asm/compat.h> | 18 | #include <asm/compat.h> |
| 17 | #include <asm/siginfo.h> | 19 | #include <asm/siginfo.h> |
| @@ -26,7 +28,7 @@ typedef __compat_gid32_t compat_gid_t; | |||
| 26 | struct compat_sel_arg_struct; | 28 | struct compat_sel_arg_struct; |
| 27 | struct rusage; | 29 | struct rusage; |
| 28 | 30 | ||
| 29 | struct compat_itimerspec { | 31 | struct compat_itimerspec { |
| 30 | struct compat_timespec it_interval; | 32 | struct compat_timespec it_interval; |
| 31 | struct compat_timespec it_value; | 33 | struct compat_timespec it_value; |
| 32 | }; | 34 | }; |
| @@ -70,9 +72,9 @@ struct compat_timex { | |||
| 70 | compat_long_t stbcnt; | 72 | compat_long_t stbcnt; |
| 71 | compat_int_t tai; | 73 | compat_int_t tai; |
| 72 | 74 | ||
| 73 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 75 | compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; |
| 74 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 76 | compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; |
| 75 | compat_int_t :32; compat_int_t :32; compat_int_t :32; | 77 | compat_int_t:32; compat_int_t:32; compat_int_t:32; |
| 76 | }; | 78 | }; |
| 77 | 79 | ||
| 78 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) | 80 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) |
| @@ -81,8 +83,10 @@ typedef struct { | |||
| 81 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; | 83 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; |
| 82 | } compat_sigset_t; | 84 | } compat_sigset_t; |
| 83 | 85 | ||
| 84 | extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *); | 86 | extern int get_compat_timespec(struct timespec *, |
| 85 | extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *); | 87 | const struct compat_timespec __user *); |
| 88 | extern int put_compat_timespec(const struct timespec *, | ||
| 89 | struct compat_timespec __user *); | ||
| 86 | 90 | ||
| 87 | struct compat_iovec { | 91 | struct compat_iovec { |
| 88 | compat_uptr_t iov_base; | 92 | compat_uptr_t iov_base; |
| @@ -113,7 +117,8 @@ struct compat_rusage { | |||
| 113 | compat_long_t ru_nivcsw; | 117 | compat_long_t ru_nivcsw; |
| 114 | }; | 118 | }; |
| 115 | 119 | ||
| 116 | extern int put_compat_rusage(const struct rusage *, struct compat_rusage __user *); | 120 | extern int put_compat_rusage(const struct rusage *, |
| 121 | struct compat_rusage __user *); | ||
| 117 | 122 | ||
| 118 | struct compat_siginfo; | 123 | struct compat_siginfo; |
| 119 | 124 | ||
| @@ -166,8 +171,7 @@ struct compat_ifmap { | |||
| 166 | unsigned char port; | 171 | unsigned char port; |
| 167 | }; | 172 | }; |
| 168 | 173 | ||
| 169 | struct compat_if_settings | 174 | struct compat_if_settings { |
| 170 | { | ||
| 171 | unsigned int type; /* Type of physical device or protocol */ | 175 | unsigned int type; /* Type of physical device or protocol */ |
| 172 | unsigned int size; /* Size of the data allocated by the caller */ | 176 | unsigned int size; /* Size of the data allocated by the caller */ |
| 173 | compat_uptr_t ifs_ifsu; /* union of pointers */ | 177 | compat_uptr_t ifs_ifsu; /* union of pointers */ |
| @@ -195,8 +199,8 @@ struct compat_ifreq { | |||
| 195 | }; | 199 | }; |
| 196 | 200 | ||
| 197 | struct compat_ifconf { | 201 | struct compat_ifconf { |
| 198 | compat_int_t ifc_len; /* size of buffer */ | 202 | compat_int_t ifc_len; /* size of buffer */ |
| 199 | compat_caddr_t ifcbuf; | 203 | compat_caddr_t ifcbuf; |
| 200 | }; | 204 | }; |
| 201 | 205 | ||
| 202 | struct compat_robust_list { | 206 | struct compat_robust_list { |
| @@ -209,6 +213,18 @@ struct compat_robust_list_head { | |||
| 209 | compat_uptr_t list_op_pending; | 213 | compat_uptr_t list_op_pending; |
| 210 | }; | 214 | }; |
| 211 | 215 | ||
| 216 | struct compat_statfs; | ||
| 217 | struct compat_statfs64; | ||
| 218 | struct compat_old_linux_dirent; | ||
| 219 | struct compat_linux_dirent; | ||
| 220 | struct linux_dirent64; | ||
| 221 | struct compat_msghdr; | ||
| 222 | struct compat_mmsghdr; | ||
| 223 | struct compat_sysinfo; | ||
| 224 | struct compat_sysctl_args; | ||
| 225 | struct compat_kexec_segment; | ||
| 226 | struct compat_mq_attr; | ||
| 227 | |||
| 212 | extern void compat_exit_robust_list(struct task_struct *curr); | 228 | extern void compat_exit_robust_list(struct task_struct *curr); |
| 213 | 229 | ||
| 214 | asmlinkage long | 230 | asmlinkage long |
| @@ -243,8 +259,8 @@ asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, | |||
| 243 | const struct compat_iovec __user *vec, | 259 | const struct compat_iovec __user *vec, |
| 244 | unsigned long vlen, u32 pos_low, u32 pos_high); | 260 | unsigned long vlen, u32 pos_low, u32 pos_high); |
| 245 | 261 | ||
| 246 | int compat_do_execve(char * filename, compat_uptr_t __user *argv, | 262 | int compat_do_execve(char *filename, compat_uptr_t __user *argv, |
| 247 | compat_uptr_t __user *envp, struct pt_regs * regs); | 263 | compat_uptr_t __user *envp, struct pt_regs *regs); |
| 248 | 264 | ||
| 249 | asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, | 265 | asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, |
| 250 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, | 266 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, |
| @@ -331,12 +347,18 @@ asmlinkage long compat_sys_epoll_pwait(int epfd, | |||
| 331 | const compat_sigset_t __user *sigmask, | 347 | const compat_sigset_t __user *sigmask, |
| 332 | compat_size_t sigsetsize); | 348 | compat_size_t sigsetsize); |
| 333 | 349 | ||
| 334 | asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, | 350 | asmlinkage long compat_sys_utime(const char __user *filename, |
| 335 | struct compat_timespec __user *t, int flags); | 351 | struct compat_utimbuf __user *t); |
| 352 | asmlinkage long compat_sys_utimensat(unsigned int dfd, | ||
| 353 | const char __user *filename, | ||
| 354 | struct compat_timespec __user *t, | ||
| 355 | int flags); | ||
| 336 | 356 | ||
| 357 | asmlinkage long compat_sys_time(compat_time_t __user *tloc); | ||
| 358 | asmlinkage long compat_sys_stime(compat_time_t __user *tptr); | ||
| 337 | asmlinkage long compat_sys_signalfd(int ufd, | 359 | asmlinkage long compat_sys_signalfd(int ufd, |
| 338 | const compat_sigset_t __user *sigmask, | 360 | const compat_sigset_t __user *sigmask, |
| 339 | compat_size_t sigsetsize); | 361 | compat_size_t sigsetsize); |
| 340 | asmlinkage long compat_sys_timerfd_settime(int ufd, int flags, | 362 | asmlinkage long compat_sys_timerfd_settime(int ufd, int flags, |
| 341 | const struct compat_itimerspec __user *utmr, | 363 | const struct compat_itimerspec __user *utmr, |
| 342 | struct compat_itimerspec __user *otmr); | 364 | struct compat_itimerspec __user *otmr); |
| @@ -348,16 +370,190 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page, | |||
| 348 | const int __user *nodes, | 370 | const int __user *nodes, |
| 349 | int __user *status, | 371 | int __user *status, |
| 350 | int flags); | 372 | int flags); |
| 351 | asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, | 373 | asmlinkage long compat_sys_futimesat(unsigned int dfd, |
| 374 | const char __user *filename, | ||
| 352 | struct compat_timeval __user *t); | 375 | struct compat_timeval __user *t); |
| 353 | asmlinkage long compat_sys_newfstatat(unsigned int dfd, const char __user * filename, | 376 | asmlinkage long compat_sys_utimes(const char __user *filename, |
| 377 | struct compat_timeval __user *t); | ||
| 378 | asmlinkage long compat_sys_newstat(const char __user *filename, | ||
| 379 | struct compat_stat __user *statbuf); | ||
| 380 | asmlinkage long compat_sys_newlstat(const char __user *filename, | ||
| 381 | struct compat_stat __user *statbuf); | ||
| 382 | asmlinkage long compat_sys_newfstatat(unsigned int dfd, | ||
| 383 | const char __user *filename, | ||
| 354 | struct compat_stat __user *statbuf, | 384 | struct compat_stat __user *statbuf, |
| 355 | int flag); | 385 | int flag); |
| 386 | asmlinkage long compat_sys_newfstat(unsigned int fd, | ||
| 387 | struct compat_stat __user *statbuf); | ||
| 388 | asmlinkage long compat_sys_statfs(const char __user *pathname, | ||
| 389 | struct compat_statfs __user *buf); | ||
| 390 | asmlinkage long compat_sys_fstatfs(unsigned int fd, | ||
| 391 | struct compat_statfs __user *buf); | ||
| 392 | asmlinkage long compat_sys_statfs64(const char __user *pathname, | ||
| 393 | compat_size_t sz, | ||
| 394 | struct compat_statfs64 __user *buf); | ||
| 395 | asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, | ||
| 396 | struct compat_statfs64 __user *buf); | ||
| 397 | asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd, | ||
| 398 | unsigned long arg); | ||
| 399 | asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd, | ||
| 400 | unsigned long arg); | ||
| 401 | asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p); | ||
| 402 | asmlinkage long compat_sys_io_getevents(aio_context_t ctx_id, | ||
| 403 | unsigned long min_nr, | ||
| 404 | unsigned long nr, | ||
| 405 | struct io_event __user *events, | ||
| 406 | struct compat_timespec __user *timeout); | ||
| 407 | asmlinkage long compat_sys_io_submit(aio_context_t ctx_id, int nr, | ||
| 408 | u32 __user *iocb); | ||
| 409 | asmlinkage long compat_sys_mount(const char __user *dev_name, | ||
| 410 | const char __user *dir_name, | ||
| 411 | const char __user *type, unsigned long flags, | ||
| 412 | const void __user *data); | ||
| 413 | asmlinkage long compat_sys_old_readdir(unsigned int fd, | ||
| 414 | struct compat_old_linux_dirent __user *, | ||
| 415 | unsigned int count); | ||
| 416 | asmlinkage long compat_sys_getdents(unsigned int fd, | ||
| 417 | struct compat_linux_dirent __user *dirent, | ||
| 418 | unsigned int count); | ||
| 419 | asmlinkage long compat_sys_getdents64(unsigned int fd, | ||
| 420 | struct linux_dirent64 __user *dirent, | ||
| 421 | unsigned int count); | ||
| 422 | asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, | ||
| 423 | unsigned int nr_segs, unsigned int flags); | ||
| 424 | asmlinkage long compat_sys_open(const char __user *filename, int flags, | ||
| 425 | int mode); | ||
| 356 | asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, | 426 | asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, |
| 357 | int flags, int mode); | 427 | int flags, int mode); |
| 428 | asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, | ||
| 429 | struct file_handle __user *handle, | ||
| 430 | int flags); | ||
| 431 | asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, | ||
| 432 | compat_ulong_t __user *outp, | ||
| 433 | compat_ulong_t __user *exp, | ||
| 434 | struct compat_timespec __user *tsp, | ||
| 435 | void __user *sig); | ||
| 436 | asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, | ||
| 437 | unsigned int nfds, | ||
| 438 | struct compat_timespec __user *tsp, | ||
| 439 | const compat_sigset_t __user *sigmask, | ||
| 440 | compat_size_t sigsetsize); | ||
| 441 | #if (defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)) && \ | ||
| 442 | !defined(CONFIG_NFSD_DEPRECATED) | ||
| 443 | union compat_nfsctl_res; | ||
| 444 | struct compat_nfsctl_arg; | ||
| 445 | asmlinkage long compat_sys_nfsservctl(int cmd, | ||
| 446 | struct compat_nfsctl_arg __user *arg, | ||
| 447 | union compat_nfsctl_res __user *res); | ||
| 448 | #else | ||
| 449 | asmlinkage long compat_sys_nfsservctl(int cmd, void *notused, void *notused2); | ||
| 450 | #endif | ||
| 451 | asmlinkage long compat_sys_signalfd4(int ufd, | ||
| 452 | const compat_sigset_t __user *sigmask, | ||
| 453 | compat_size_t sigsetsize, int flags); | ||
| 454 | asmlinkage long compat_sys_get_mempolicy(int __user *policy, | ||
| 455 | compat_ulong_t __user *nmask, | ||
| 456 | compat_ulong_t maxnode, | ||
| 457 | compat_ulong_t addr, | ||
| 458 | compat_ulong_t flags); | ||
| 459 | asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask, | ||
| 460 | compat_ulong_t maxnode); | ||
| 461 | asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len, | ||
| 462 | compat_ulong_t mode, | ||
| 463 | compat_ulong_t __user *nmask, | ||
| 464 | compat_ulong_t maxnode, compat_ulong_t flags); | ||
| 465 | |||
| 466 | asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, | ||
| 467 | char __user *optval, unsigned int optlen); | ||
| 468 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, | ||
| 469 | unsigned flags); | ||
| 470 | asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, | ||
| 471 | unsigned int flags); | ||
| 472 | asmlinkage long compat_sys_recv(int fd, void __user *buf, size_t len, | ||
| 473 | unsigned flags); | ||
| 474 | asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len, | ||
| 475 | unsigned flags, struct sockaddr __user *addr, | ||
| 476 | int __user *addrlen); | ||
| 477 | asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, | ||
| 478 | unsigned vlen, unsigned int flags, | ||
| 479 | struct compat_timespec __user *timeout); | ||
| 480 | asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, | ||
| 481 | struct compat_timespec __user *rmtp); | ||
| 482 | asmlinkage long compat_sys_getitimer(int which, | ||
| 483 | struct compat_itimerval __user *it); | ||
| 484 | asmlinkage long compat_sys_setitimer(int which, | ||
| 485 | struct compat_itimerval __user *in, | ||
| 486 | struct compat_itimerval __user *out); | ||
| 487 | asmlinkage long compat_sys_times(struct compat_tms __user *tbuf); | ||
| 488 | asmlinkage long compat_sys_setrlimit(unsigned int resource, | ||
| 489 | struct compat_rlimit __user *rlim); | ||
| 490 | asmlinkage long compat_sys_getrlimit(unsigned int resource, | ||
| 491 | struct compat_rlimit __user *rlim); | ||
| 492 | asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru); | ||
| 493 | asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, | ||
| 494 | unsigned int len, | ||
| 495 | compat_ulong_t __user *user_mask_ptr); | ||
| 496 | asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, | ||
| 497 | unsigned int len, | ||
| 498 | compat_ulong_t __user *user_mask_ptr); | ||
| 499 | asmlinkage long compat_sys_timer_create(clockid_t which_clock, | ||
| 500 | struct compat_sigevent __user *timer_event_spec, | ||
| 501 | timer_t __user *created_timer_id); | ||
| 502 | asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags, | ||
| 503 | struct compat_itimerspec __user *new, | ||
| 504 | struct compat_itimerspec __user *old); | ||
| 505 | asmlinkage long compat_sys_timer_gettime(timer_t timer_id, | ||
| 506 | struct compat_itimerspec __user *setting); | ||
| 507 | asmlinkage long compat_sys_clock_settime(clockid_t which_clock, | ||
| 508 | struct compat_timespec __user *tp); | ||
| 509 | asmlinkage long compat_sys_clock_gettime(clockid_t which_clock, | ||
| 510 | struct compat_timespec __user *tp); | ||
| 511 | asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock, | ||
| 512 | struct compat_timex __user *tp); | ||
| 513 | asmlinkage long compat_sys_clock_getres(clockid_t which_clock, | ||
| 514 | struct compat_timespec __user *tp); | ||
| 515 | asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, | ||
| 516 | struct compat_timespec __user *rqtp, | ||
| 517 | struct compat_timespec __user *rmtp); | ||
| 518 | asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese, | ||
| 519 | struct compat_siginfo __user *uinfo, | ||
| 520 | struct compat_timespec __user *uts, compat_size_t sigsetsize); | ||
| 521 | asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, | ||
| 522 | compat_size_t sigsetsize); | ||
| 523 | asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info); | ||
| 524 | asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, | ||
| 525 | unsigned long arg); | ||
| 526 | asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, | ||
| 527 | struct compat_timespec __user *utime, u32 __user *uaddr2, | ||
| 528 | u32 val3); | ||
| 529 | asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, | ||
| 530 | char __user *optval, int __user *optlen); | ||
| 531 | asmlinkage long compat_sys_kexec_load(unsigned long entry, | ||
| 532 | unsigned long nr_segments, | ||
| 533 | struct compat_kexec_segment __user *, | ||
| 534 | unsigned long flags); | ||
| 535 | asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, | ||
| 536 | const struct compat_mq_attr __user *u_mqstat, | ||
| 537 | struct compat_mq_attr __user *u_omqstat); | ||
| 538 | asmlinkage long compat_sys_mq_notify(mqd_t mqdes, | ||
| 539 | const struct compat_sigevent __user *u_notification); | ||
| 540 | asmlinkage long compat_sys_mq_open(const char __user *u_name, | ||
| 541 | int oflag, compat_mode_t mode, | ||
| 542 | struct compat_mq_attr __user *u_attr); | ||
| 543 | asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes, | ||
| 544 | const char __user *u_msg_ptr, | ||
| 545 | size_t msg_len, unsigned int msg_prio, | ||
| 546 | const struct compat_timespec __user *u_abs_timeout); | ||
| 547 | asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, | ||
| 548 | char __user *u_msg_ptr, | ||
| 549 | size_t msg_len, unsigned int __user *u_msg_prio, | ||
| 550 | const struct compat_timespec __user *u_abs_timeout); | ||
| 551 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args); | ||
| 552 | asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args); | ||
| 358 | 553 | ||
| 359 | extern ssize_t compat_rw_copy_check_uvector(int type, | 554 | extern ssize_t compat_rw_copy_check_uvector(int type, |
| 360 | const struct compat_iovec __user *uvector, unsigned long nr_segs, | 555 | const struct compat_iovec __user *uvector, |
| 556 | unsigned long nr_segs, | ||
| 361 | unsigned long fast_segs, struct iovec *fast_pointer, | 557 | unsigned long fast_segs, struct iovec *fast_pointer, |
| 362 | struct iovec **ret_pointer); | 558 | struct iovec **ret_pointer); |
| 363 | 559 | ||
