diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 10:21:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 10:21:43 -0400 |
commit | 08d76760832993050ad8c25e63b56773ef2ca303 (patch) | |
tree | abdcf148dfe43cd49f30f204f1dac6978107a508 /include | |
parent | 5f56886521d6ddd3648777fae44d82382dd8c87f (diff) | |
parent | 99e621f796d7f0341a51e8cdf32b81663b10b448 (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')
-rw-r--r-- | include/asm-generic/unistd.h | 17 | ||||
-rw-r--r-- | include/linux/compat.h | 51 | ||||
-rw-r--r-- | include/linux/linkage.h | 21 | ||||
-rw-r--r-- | include/linux/mm.h | 3 | ||||
-rw-r--r-- | include/linux/syscalls.h | 156 |
5 files changed, 86 insertions, 162 deletions
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index 4077b5d9ff81..0501fa3f783d 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
@@ -9,20 +9,3 @@ | |||
9 | #define __ARCH_WANT_STAT64 | 9 | #define __ARCH_WANT_STAT64 |
10 | #define __ARCH_WANT_SYS_LLSEEK | 10 | #define __ARCH_WANT_SYS_LLSEEK |
11 | #endif | 11 | #endif |
12 | |||
13 | /* | ||
14 | * "Conditional" syscalls | ||
15 | * | ||
16 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
17 | * but it doesn't work on all toolchains, so we just do it by hand | ||
18 | */ | ||
19 | #ifndef cond_syscall | ||
20 | #ifdef CONFIG_SYMBOL_PREFIX | ||
21 | #define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | ||
22 | #else | ||
23 | #define __SYMBOL_PREFIX | ||
24 | #endif | ||
25 | #define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \ | ||
26 | ".set\t" __SYMBOL_PREFIX #x "," \ | ||
27 | __SYMBOL_PREFIX "sys_ni_syscall") | ||
28 | #endif | ||
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 | |||
326 | compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, | 311 | compat_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 | 314 | asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32); |
330 | long compat_sys_semctl(int first, int second, int third, void __user *uptr); | 315 | asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); |
331 | long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); | 316 | asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg); |
332 | long compat_sys_msgrcv(int first, int second, int msgtyp, int third, | 317 | asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp, |
333 | int version, void __user *uptr); | ||
334 | long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, | ||
335 | void __user *uptr); | ||
336 | #else | ||
337 | long compat_sys_semctl(int semid, int semnum, int cmd, int arg); | ||
338 | long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, | ||
339 | compat_ssize_t msgsz, int msgflg); | 318 | compat_ssize_t msgsz, int msgflg); |
340 | long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, | 319 | asmlinkage 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); |
342 | long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); | ||
343 | #endif | ||
344 | long compat_sys_msgctl(int first, int second, void __user *uptr); | 321 | long compat_sys_msgctl(int first, int second, void __user *uptr); |
345 | long compat_sys_shmctl(int first, int second, void __user *uptr); | 322 | long compat_sys_shmctl(int first, int second, void __user *uptr); |
346 | long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, | 323 | long 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, | |||
444 | asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, | 421 | asmlinkage 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 | ||
424 | asmlinkage 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 | */ |
450 | struct epoll_event; | 428 | struct epoll_event; /* fortunately, this one is fixed-layout */ |
451 | #define compat_epoll_event epoll_event | ||
452 | asmlinkage long compat_sys_epoll_pwait(int epfd, | 429 | asmlinkage 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 | ||
686 | asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, | 663 | asmlinkage 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); |
665 | asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, | ||
666 | compat_loff_t __user *offset, compat_size_t count); | ||
688 | asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, | 667 | asmlinkage 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 | ||
diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 807f1e533226..829d66c67fc2 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_LINKAGE_H | 2 | #define _LINUX_LINKAGE_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/stringify.h> | ||
5 | #include <asm/linkage.h> | 6 | #include <asm/linkage.h> |
6 | 7 | ||
7 | #ifdef __cplusplus | 8 | #ifdef __cplusplus |
@@ -14,6 +15,26 @@ | |||
14 | #define asmlinkage CPP_ASMLINKAGE | 15 | #define asmlinkage CPP_ASMLINKAGE |
15 | #endif | 16 | #endif |
16 | 17 | ||
18 | #ifndef SYMBOL_NAME | ||
19 | #ifdef CONFIG_SYMBOL_PREFIX | ||
20 | #define SYMBOL_NAME(x) CONFIG_SYMBOL_PREFIX ## x | ||
21 | #else | ||
22 | #define SYMBOL_NAME(x) x | ||
23 | #endif | ||
24 | #endif | ||
25 | #define __SYMBOL_NAME(x) __stringify(SYMBOL_NAME(x)) | ||
26 | |||
27 | #ifndef cond_syscall | ||
28 | #define cond_syscall(x) asm(".weak\t" __SYMBOL_NAME(x) \ | ||
29 | "\n\t.set\t" __SYMBOL_NAME(x) "," __SYMBOL_NAME(sys_ni_syscall)); | ||
30 | #endif | ||
31 | |||
32 | #ifndef SYSCALL_ALIAS | ||
33 | #define SYSCALL_ALIAS(alias, name) \ | ||
34 | asm ("\t.globl " __SYMBOL_NAME(alias) \ | ||
35 | "\n\t.set\t" __SYMBOL_NAME(alias) "," __SYMBOL_NAME(name)) | ||
36 | #endif | ||
37 | |||
17 | #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) | 38 | #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) |
18 | #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) | 39 | #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) |
19 | 40 | ||
diff --git a/include/linux/mm.h b/include/linux/mm.h index c05d7cfbb6b9..1a7f19e7f1a0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1082,9 +1082,6 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma, | |||
1082 | unsigned long old_addr, struct vm_area_struct *new_vma, | 1082 | unsigned long old_addr, struct vm_area_struct *new_vma, |
1083 | unsigned long new_addr, unsigned long len, | 1083 | unsigned long new_addr, unsigned long len, |
1084 | bool need_rmap_locks); | 1084 | bool need_rmap_locks); |
1085 | extern unsigned long do_mremap(unsigned long addr, | ||
1086 | unsigned long old_len, unsigned long new_len, | ||
1087 | unsigned long flags, unsigned long new_addr); | ||
1088 | extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start, | 1085 | extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start, |
1089 | unsigned long end, pgprot_t newprot, | 1086 | unsigned long end, pgprot_t newprot, |
1090 | int dirty_accountable, int prot_numa); | 1087 | int dirty_accountable, int prot_numa); |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 313a8e0a6553..4147d700a293 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -78,49 +78,34 @@ struct sigaltstack; | |||
78 | #include <linux/key.h> | 78 | #include <linux/key.h> |
79 | #include <trace/syscall.h> | 79 | #include <trace/syscall.h> |
80 | 80 | ||
81 | #define __SC_DECL1(t1, a1) t1 a1 | 81 | /* |
82 | #define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) | 82 | * __MAP - apply a macro to syscall arguments |
83 | #define __SC_DECL3(t3, a3, ...) t3 a3, __SC_DECL2(__VA_ARGS__) | 83 | * __MAP(n, m, t1, a1, t2, a2, ..., tn, an) will expand to |
84 | #define __SC_DECL4(t4, a4, ...) t4 a4, __SC_DECL3(__VA_ARGS__) | 84 | * m(t1, a1), m(t2, a2), ..., m(tn, an) |
85 | #define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__) | 85 | * The first argument must be equal to the amount of type/name |
86 | #define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__) | 86 | * pairs given. Note that this list of pairs (i.e. the arguments |
87 | 87 | * of __MAP starting at the third one) is in the same format as | |
88 | #define __SC_LONG1(t1, a1) long a1 | 88 | * for SYSCALL_DEFINE<n>/COMPAT_SYSCALL_DEFINE<n> |
89 | #define __SC_LONG2(t2, a2, ...) long a2, __SC_LONG1(__VA_ARGS__) | 89 | */ |
90 | #define __SC_LONG3(t3, a3, ...) long a3, __SC_LONG2(__VA_ARGS__) | 90 | #define __MAP0(m,...) |
91 | #define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__) | 91 | #define __MAP1(m,t,a) m(t,a) |
92 | #define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__) | 92 | #define __MAP2(m,t,a,...) m(t,a), __MAP1(m,__VA_ARGS__) |
93 | #define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__) | 93 | #define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__) |
94 | 94 | #define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__) | |
95 | #define __SC_CAST1(t1, a1) (t1) a1 | 95 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__) |
96 | #define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__) | 96 | #define __MAP6(m,t,a,...) m(t,a), __MAP5(m,__VA_ARGS__) |
97 | #define __SC_CAST3(t3, a3, ...) (t3) a3, __SC_CAST2(__VA_ARGS__) | 97 | #define __MAP(n,...) __MAP##n(__VA_ARGS__) |
98 | #define __SC_CAST4(t4, a4, ...) (t4) a4, __SC_CAST3(__VA_ARGS__) | 98 | |
99 | #define __SC_CAST5(t5, a5, ...) (t5) a5, __SC_CAST4(__VA_ARGS__) | 99 | #define __SC_DECL(t, a) t a |
100 | #define __SC_CAST6(t6, a6, ...) (t6) a6, __SC_CAST5(__VA_ARGS__) | 100 | #define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL)) |
101 | 101 | #define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a | |
102 | #define __SC_TEST(type) BUILD_BUG_ON(sizeof(type) > sizeof(long)) | 102 | #define __SC_CAST(t, a) (t) a |
103 | #define __SC_TEST1(t1, a1) __SC_TEST(t1) | 103 | #define __SC_ARGS(t, a) a |
104 | #define __SC_TEST2(t2, a2, ...) __SC_TEST(t2); __SC_TEST1(__VA_ARGS__) | 104 | #define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long)) |
105 | #define __SC_TEST3(t3, a3, ...) __SC_TEST(t3); __SC_TEST2(__VA_ARGS__) | ||
106 | #define __SC_TEST4(t4, a4, ...) __SC_TEST(t4); __SC_TEST3(__VA_ARGS__) | ||
107 | #define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) | ||
108 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) | ||
109 | 105 | ||
110 | #ifdef CONFIG_FTRACE_SYSCALLS | 106 | #ifdef CONFIG_FTRACE_SYSCALLS |
111 | #define __SC_STR_ADECL1(t, a) #a | 107 | #define __SC_STR_ADECL(t, a) #a |
112 | #define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) | 108 | #define __SC_STR_TDECL(t, a) #t |
113 | #define __SC_STR_ADECL3(t, a, ...) #a, __SC_STR_ADECL2(__VA_ARGS__) | ||
114 | #define __SC_STR_ADECL4(t, a, ...) #a, __SC_STR_ADECL3(__VA_ARGS__) | ||
115 | #define __SC_STR_ADECL5(t, a, ...) #a, __SC_STR_ADECL4(__VA_ARGS__) | ||
116 | #define __SC_STR_ADECL6(t, a, ...) #a, __SC_STR_ADECL5(__VA_ARGS__) | ||
117 | |||
118 | #define __SC_STR_TDECL1(t, a) #t | ||
119 | #define __SC_STR_TDECL2(t, a, ...) #t, __SC_STR_TDECL1(__VA_ARGS__) | ||
120 | #define __SC_STR_TDECL3(t, a, ...) #t, __SC_STR_TDECL2(__VA_ARGS__) | ||
121 | #define __SC_STR_TDECL4(t, a, ...) #t, __SC_STR_TDECL3(__VA_ARGS__) | ||
122 | #define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__) | ||
123 | #define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) | ||
124 | 109 | ||
125 | extern struct ftrace_event_class event_class_syscall_enter; | 110 | extern struct ftrace_event_class event_class_syscall_enter; |
126 | extern struct ftrace_event_class event_class_syscall_exit; | 111 | extern struct ftrace_event_class event_class_syscall_exit; |
@@ -155,7 +140,13 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
155 | __attribute__((section("_ftrace_events"))) \ | 140 | __attribute__((section("_ftrace_events"))) \ |
156 | *__event_exit_##sname = &event_exit_##sname; | 141 | *__event_exit_##sname = &event_exit_##sname; |
157 | 142 | ||
158 | #define SYSCALL_METADATA(sname, nb) \ | 143 | #define SYSCALL_METADATA(sname, nb, ...) \ |
144 | static const char *types_##sname[] = { \ | ||
145 | __MAP(nb,__SC_STR_TDECL,__VA_ARGS__) \ | ||
146 | }; \ | ||
147 | static const char *args_##sname[] = { \ | ||
148 | __MAP(nb,__SC_STR_ADECL,__VA_ARGS__) \ | ||
149 | }; \ | ||
159 | SYSCALL_TRACE_ENTER_EVENT(sname); \ | 150 | SYSCALL_TRACE_ENTER_EVENT(sname); \ |
160 | SYSCALL_TRACE_EXIT_EVENT(sname); \ | 151 | SYSCALL_TRACE_EXIT_EVENT(sname); \ |
161 | static struct syscall_metadata __used \ | 152 | static struct syscall_metadata __used \ |
@@ -163,8 +154,8 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
163 | .name = "sys"#sname, \ | 154 | .name = "sys"#sname, \ |
164 | .syscall_nr = -1, /* Filled in at boot */ \ | 155 | .syscall_nr = -1, /* Filled in at boot */ \ |
165 | .nb_args = nb, \ | 156 | .nb_args = nb, \ |
166 | .types = types_##sname, \ | 157 | .types = nb ? types_##sname : NULL, \ |
167 | .args = args_##sname, \ | 158 | .args = nb ? args_##sname : NULL, \ |
168 | .enter_event = &event_enter_##sname, \ | 159 | .enter_event = &event_enter_##sname, \ |
169 | .exit_event = &event_exit_##sname, \ | 160 | .exit_event = &event_exit_##sname, \ |
170 | .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ | 161 | .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ |
@@ -172,26 +163,13 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
172 | static struct syscall_metadata __used \ | 163 | static struct syscall_metadata __used \ |
173 | __attribute__((section("__syscalls_metadata"))) \ | 164 | __attribute__((section("__syscalls_metadata"))) \ |
174 | *__p_syscall_meta_##sname = &__syscall_meta_##sname; | 165 | *__p_syscall_meta_##sname = &__syscall_meta_##sname; |
166 | #else | ||
167 | #define SYSCALL_METADATA(sname, nb, ...) | ||
168 | #endif | ||
175 | 169 | ||
176 | #define SYSCALL_DEFINE0(sname) \ | 170 | #define SYSCALL_DEFINE0(sname) \ |
177 | SYSCALL_TRACE_ENTER_EVENT(_##sname); \ | 171 | SYSCALL_METADATA(_##sname, 0); \ |
178 | SYSCALL_TRACE_EXIT_EVENT(_##sname); \ | ||
179 | static struct syscall_metadata __used \ | ||
180 | __syscall_meta__##sname = { \ | ||
181 | .name = "sys_"#sname, \ | ||
182 | .syscall_nr = -1, /* Filled in at boot */ \ | ||
183 | .nb_args = 0, \ | ||
184 | .enter_event = &event_enter__##sname, \ | ||
185 | .exit_event = &event_exit__##sname, \ | ||
186 | .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \ | ||
187 | }; \ | ||
188 | static struct syscall_metadata __used \ | ||
189 | __attribute__((section("__syscalls_metadata"))) \ | ||
190 | *__p_syscall_meta_##sname = &__syscall_meta__##sname; \ | ||
191 | asmlinkage long sys_##sname(void) | 172 | asmlinkage long sys_##sname(void) |
192 | #else | ||
193 | #define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) | ||
194 | #endif | ||
195 | 173 | ||
196 | #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) | 174 | #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) |
197 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) | 175 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) |
@@ -200,57 +178,23 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
200 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) | 178 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) |
201 | #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) | 179 | #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) |
202 | 180 | ||
203 | #ifdef CONFIG_PPC64 | ||
204 | #define SYSCALL_ALIAS(alias, name) \ | ||
205 | asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \ | ||
206 | "\t.globl ." #alias "\n\t.set ." #alias ", ." #name) | ||
207 | #else | ||
208 | #if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS) | ||
209 | #define SYSCALL_ALIAS(alias, name) \ | ||
210 | asm ( #alias " = " #name "\n\t.globl " #alias) | ||
211 | #else | ||
212 | #define SYSCALL_ALIAS(alias, name) \ | ||
213 | asm ("\t.globl " #alias "\n\t.set " #alias ", " #name) | ||
214 | #endif | ||
215 | #endif | ||
216 | |||
217 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
218 | #define SYSCALL_DEFINEx(x, sname, ...) \ | 181 | #define SYSCALL_DEFINEx(x, sname, ...) \ |
219 | static const char *types_##sname[] = { \ | 182 | SYSCALL_METADATA(sname, x, __VA_ARGS__) \ |
220 | __SC_STR_TDECL##x(__VA_ARGS__) \ | ||
221 | }; \ | ||
222 | static const char *args_##sname[] = { \ | ||
223 | __SC_STR_ADECL##x(__VA_ARGS__) \ | ||
224 | }; \ | ||
225 | SYSCALL_METADATA(sname, x); \ | ||
226 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) | 183 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) |
227 | #else | ||
228 | #define SYSCALL_DEFINEx(x, sname, ...) \ | ||
229 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) | ||
230 | #endif | ||
231 | |||
232 | #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS | ||
233 | |||
234 | #define SYSCALL_DEFINE(name) static inline long SYSC_##name | ||
235 | 184 | ||
185 | #define __PROTECT(...) asmlinkage_protect(__VA_ARGS__) | ||
236 | #define __SYSCALL_DEFINEx(x, name, ...) \ | 186 | #define __SYSCALL_DEFINEx(x, name, ...) \ |
237 | asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \ | 187 | asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ |
238 | static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ | 188 | static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ |
239 | asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__)) \ | 189 | asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ |
240 | { \ | 190 | { \ |
241 | __SC_TEST##x(__VA_ARGS__); \ | 191 | long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \ |
242 | return (long) SYSC##name(__SC_CAST##x(__VA_ARGS__)); \ | 192 | __MAP(x,__SC_TEST,__VA_ARGS__); \ |
193 | __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ | ||
194 | return ret; \ | ||
243 | } \ | 195 | } \ |
244 | SYSCALL_ALIAS(sys##name, SyS##name); \ | 196 | SYSCALL_ALIAS(sys##name, SyS##name); \ |
245 | static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)) | 197 | static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) |
246 | |||
247 | #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
248 | |||
249 | #define SYSCALL_DEFINE(name) asmlinkage long sys_##name | ||
250 | #define __SYSCALL_DEFINEx(x, name, ...) \ | ||
251 | asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)) | ||
252 | |||
253 | #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
254 | 198 | ||
255 | asmlinkage long sys_time(time_t __user *tloc); | 199 | asmlinkage long sys_time(time_t __user *tloc); |
256 | asmlinkage long sys_stime(time_t __user *tptr); | 200 | asmlinkage long sys_stime(time_t __user *tptr); |
@@ -694,7 +638,7 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf); | |||
694 | asmlinkage long sys_semget(key_t key, int nsems, int semflg); | 638 | asmlinkage long sys_semget(key_t key, int nsems, int semflg); |
695 | asmlinkage long sys_semop(int semid, struct sembuf __user *sops, | 639 | asmlinkage long sys_semop(int semid, struct sembuf __user *sops, |
696 | unsigned nsops); | 640 | unsigned nsops); |
697 | asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg); | 641 | asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg); |
698 | asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, | 642 | asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, |
699 | unsigned nsops, | 643 | unsigned nsops, |
700 | const struct timespec __user *timeout); | 644 | const struct timespec __user *timeout); |