aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compat.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 10:21:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 10:21:43 -0400
commit08d76760832993050ad8c25e63b56773ef2ca303 (patch)
treeabdcf148dfe43cd49f30f204f1dac6978107a508 /include/linux/compat.h
parent5f56886521d6ddd3648777fae44d82382dd8c87f (diff)
parent99e621f796d7f0341a51e8cdf32b81663b10b448 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull compat cleanup from Al Viro: "Mostly about syscall wrappers this time; there will be another pile with patches in the same general area from various people, but I'd rather push those after both that and vfs.git pile are in." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: syscalls.h: slightly reduce the jungles of macros get rid of union semop in sys_semctl(2) arguments make do_mremap() static sparc: no need to sign-extend in sync_file_range() wrapper ppc compat wrappers for add_key(2) and request_key(2) are pointless x86: trim sys_ia32.h x86: sys32_kill and sys32_mprotect are pointless get rid of compat_sys_semctl() and friends in case of ARCH_WANT_OLD_COMPAT_IPC merge compat sys_ipc instances consolidate compat lookup_dcookie() convert vmsplice to COMPAT_SYSCALL_DEFINE switch getrusage() to COMPAT_SYSCALL_DEFINE switch epoll_pwait to COMPAT_SYSCALL_DEFINE convert sendfile{,64} to COMPAT_SYSCALL_DEFINE switch signalfd{,4}() to COMPAT_SYSCALL_DEFINE make SYSCALL_DEFINE<n>-generated wrappers do asmlinkage_protect make HAVE_SYSCALL_WRAPPERS unconditional consolidate cond_syscall and SYSCALL_ALIAS declarations teach SYSCALL_DEFINE<n> how to deal with long long/unsigned long long get rid of duplicate logics in __SC_....[1-6] definitions
Diffstat (limited to 'include/linux/compat.h')
-rw-r--r--include/linux/compat.h51
1 files changed, 15 insertions, 36 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 377cd8c3395e..d53c35352ea9 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -27,12 +27,6 @@
27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) 27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
28#endif 28#endif
29 29
30#define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1)
31#define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__)
32#define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__)
33#define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__)
34#define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__)
35#define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__)
36#define COMPAT_SYSCALL_DEFINE1(name, ...) \ 30#define COMPAT_SYSCALL_DEFINE1(name, ...) \
37 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) 31 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
38#define COMPAT_SYSCALL_DEFINE2(name, ...) \ 32#define COMPAT_SYSCALL_DEFINE2(name, ...) \
@@ -46,24 +40,15 @@
46#define COMPAT_SYSCALL_DEFINE6(name, ...) \ 40#define COMPAT_SYSCALL_DEFINE6(name, ...) \
47 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 41 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
48 42
49#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
50
51#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 43#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
52 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \ 44 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
53 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ 45 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
54 asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \ 46 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
55 { \ 47 { \
56 return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \ 48 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \
57 } \ 49 } \
58 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \ 50 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \
59 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)) 51 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
60
61#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
62
63#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
64 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__))
65
66#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
67 52
68#ifndef compat_user_stack_pointer 53#ifndef compat_user_stack_pointer
69#define compat_user_stack_pointer() current_user_stack_pointer() 54#define compat_user_stack_pointer() current_user_stack_pointer()
@@ -326,21 +311,13 @@ asmlinkage long
326compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, 311compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
327 compat_size_t __user *len_ptr); 312 compat_size_t __user *len_ptr);
328 313
329#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC 314asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
330long compat_sys_semctl(int first, int second, int third, void __user *uptr); 315asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
331long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); 316asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
332long compat_sys_msgrcv(int first, int second, int msgtyp, int third, 317asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,
333 int version, void __user *uptr);
334long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
335 void __user *uptr);
336#else
337long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
338long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
339 compat_ssize_t msgsz, int msgflg); 318 compat_ssize_t msgsz, int msgflg);
340long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, 319asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp,
341 compat_ssize_t msgsz, long msgtyp, int msgflg); 320 compat_ssize_t msgsz, long msgtyp, int msgflg);
342long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
343#endif
344long compat_sys_msgctl(int first, int second, void __user *uptr); 321long compat_sys_msgctl(int first, int second, void __user *uptr);
345long compat_sys_shmctl(int first, int second, void __user *uptr); 322long compat_sys_shmctl(int first, int second, void __user *uptr);
346long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, 323long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
@@ -444,13 +421,13 @@ extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
444asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, 421asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
445 compat_long_t addr, compat_long_t data); 422 compat_long_t addr, compat_long_t data);
446 423
424asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, size_t);
447/* 425/*
448 * epoll (fs/eventpoll.c) compat bits follow ... 426 * epoll (fs/eventpoll.c) compat bits follow ...
449 */ 427 */
450struct epoll_event; 428struct epoll_event; /* fortunately, this one is fixed-layout */
451#define compat_epoll_event epoll_event
452asmlinkage long compat_sys_epoll_pwait(int epfd, 429asmlinkage long compat_sys_epoll_pwait(int epfd,
453 struct compat_epoll_event __user *events, 430 struct epoll_event __user *events,
454 int maxevents, int timeout, 431 int maxevents, int timeout,
455 const compat_sigset_t __user *sigmask, 432 const compat_sigset_t __user *sigmask,
456 compat_size_t sigsetsize); 433 compat_size_t sigsetsize);
@@ -685,6 +662,8 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
685 662
686asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 663asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
687 compat_off_t __user *offset, compat_size_t count); 664 compat_off_t __user *offset, compat_size_t count);
665asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
666 compat_loff_t __user *offset, compat_size_t count);
688asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, 667asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
689 compat_stack_t __user *uoss_ptr); 668 compat_stack_t __user *uoss_ptr);
690 669