diff options
-rw-r--r-- | arch/x86/ia32/ia32entry.S | 1 | ||||
-rw-r--r-- | arch/x86/kernel/syscall_table_32.S | 1 | ||||
-rw-r--r-- | fs/compat.c | 14 | ||||
-rw-r--r-- | fs/signalfd.c | 14 | ||||
-rw-r--r-- | include/asm-x86/unistd_32.h | 1 | ||||
-rw-r--r-- | include/asm-x86/unistd_64.h | 2 | ||||
-rw-r--r-- | include/linux/signalfd.h | 5 | ||||
-rw-r--r-- | include/linux/syscalls.h | 1 | ||||
-rw-r--r-- | kernel/sys_ni.c | 1 |
9 files changed, 34 insertions, 6 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 021d71bc69b5..c308128b9251 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -826,4 +826,5 @@ ia32_sys_call_table: | |||
826 | .quad sys32_fallocate | 826 | .quad sys32_fallocate |
827 | .quad compat_sys_timerfd_settime /* 325 */ | 827 | .quad compat_sys_timerfd_settime /* 325 */ |
828 | .quad compat_sys_timerfd_gettime | 828 | .quad compat_sys_timerfd_gettime |
829 | .quad compat_sys_signalfd4 | ||
829 | ia32_syscall_end: | 830 | ia32_syscall_end: |
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S index adff5562f5fd..c12a36c9fd51 100644 --- a/arch/x86/kernel/syscall_table_32.S +++ b/arch/x86/kernel/syscall_table_32.S | |||
@@ -326,3 +326,4 @@ ENTRY(sys_call_table) | |||
326 | .long sys_fallocate | 326 | .long sys_fallocate |
327 | .long sys_timerfd_settime /* 325 */ | 327 | .long sys_timerfd_settime /* 325 */ |
328 | .long sys_timerfd_gettime | 328 | .long sys_timerfd_gettime |
329 | .long sys_signalfd4 | ||
diff --git a/fs/compat.c b/fs/compat.c index b46604281766..106eba28ec5a 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -2131,9 +2131,9 @@ asmlinkage long compat_sys_epoll_pwait(int epfd, | |||
2131 | 2131 | ||
2132 | #ifdef CONFIG_SIGNALFD | 2132 | #ifdef CONFIG_SIGNALFD |
2133 | 2133 | ||
2134 | asmlinkage long compat_sys_signalfd(int ufd, | 2134 | asmlinkage long compat_sys_signalfd4(int ufd, |
2135 | const compat_sigset_t __user *sigmask, | 2135 | const compat_sigset_t __user *sigmask, |
2136 | compat_size_t sigsetsize) | 2136 | compat_size_t sigsetsize, int flags) |
2137 | { | 2137 | { |
2138 | compat_sigset_t ss32; | 2138 | compat_sigset_t ss32; |
2139 | sigset_t tmp; | 2139 | sigset_t tmp; |
@@ -2148,9 +2148,15 @@ asmlinkage long compat_sys_signalfd(int ufd, | |||
2148 | if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t))) | 2148 | if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t))) |
2149 | return -EFAULT; | 2149 | return -EFAULT; |
2150 | 2150 | ||
2151 | return sys_signalfd(ufd, ksigmask, sizeof(sigset_t)); | 2151 | return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags); |
2152 | } | 2152 | } |
2153 | 2153 | ||
2154 | asmlinkage long compat_sys_signalfd(int ufd, | ||
2155 | const compat_sigset_t __user *sigmask, | ||
2156 | compat_size_t sigsetsize) | ||
2157 | { | ||
2158 | return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0); | ||
2159 | } | ||
2154 | #endif /* CONFIG_SIGNALFD */ | 2160 | #endif /* CONFIG_SIGNALFD */ |
2155 | 2161 | ||
2156 | #ifdef CONFIG_TIMERFD | 2162 | #ifdef CONFIG_TIMERFD |
diff --git a/fs/signalfd.c b/fs/signalfd.c index ddb328b74bde..c8609fa51a13 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -205,11 +205,15 @@ static const struct file_operations signalfd_fops = { | |||
205 | .read = signalfd_read, | 205 | .read = signalfd_read, |
206 | }; | 206 | }; |
207 | 207 | ||
208 | asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask) | 208 | asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, |
209 | size_t sizemask, int flags) | ||
209 | { | 210 | { |
210 | sigset_t sigmask; | 211 | sigset_t sigmask; |
211 | struct signalfd_ctx *ctx; | 212 | struct signalfd_ctx *ctx; |
212 | 213 | ||
214 | if (flags & ~SFD_CLOEXEC) | ||
215 | return -EINVAL; | ||
216 | |||
213 | if (sizemask != sizeof(sigset_t) || | 217 | if (sizemask != sizeof(sigset_t) || |
214 | copy_from_user(&sigmask, user_mask, sizeof(sigmask))) | 218 | copy_from_user(&sigmask, user_mask, sizeof(sigmask))) |
215 | return -EINVAL; | 219 | return -EINVAL; |
@@ -228,7 +232,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas | |||
228 | * anon_inode_getfd() will install the fd. | 232 | * anon_inode_getfd() will install the fd. |
229 | */ | 233 | */ |
230 | ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx, | 234 | ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx, |
231 | 0); | 235 | flags & O_CLOEXEC); |
232 | if (ufd < 0) | 236 | if (ufd < 0) |
233 | kfree(ctx); | 237 | kfree(ctx); |
234 | } else { | 238 | } else { |
@@ -250,3 +254,9 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas | |||
250 | 254 | ||
251 | return ufd; | 255 | return ufd; |
252 | } | 256 | } |
257 | |||
258 | asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, | ||
259 | size_t sizemask) | ||
260 | { | ||
261 | return sys_signalfd4(ufd, user_mask, sizemask, 0); | ||
262 | } | ||
diff --git a/include/asm-x86/unistd_32.h b/include/asm-x86/unistd_32.h index 8317d94771d3..c310371f5613 100644 --- a/include/asm-x86/unistd_32.h +++ b/include/asm-x86/unistd_32.h | |||
@@ -332,6 +332,7 @@ | |||
332 | #define __NR_fallocate 324 | 332 | #define __NR_fallocate 324 |
333 | #define __NR_timerfd_settime 325 | 333 | #define __NR_timerfd_settime 325 |
334 | #define __NR_timerfd_gettime 326 | 334 | #define __NR_timerfd_gettime 326 |
335 | #define __NR_signalfd4 327 | ||
335 | 336 | ||
336 | #ifdef __KERNEL__ | 337 | #ifdef __KERNEL__ |
337 | 338 | ||
diff --git a/include/asm-x86/unistd_64.h b/include/asm-x86/unistd_64.h index e323994a370f..e0a9b45b2346 100644 --- a/include/asm-x86/unistd_64.h +++ b/include/asm-x86/unistd_64.h | |||
@@ -641,6 +641,8 @@ __SYSCALL(__NR_timerfd_settime, sys_timerfd_settime) | |||
641 | __SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime) | 641 | __SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime) |
642 | #define __NR_paccept 288 | 642 | #define __NR_paccept 288 |
643 | __SYSCALL(__NR_paccept, sys_paccept) | 643 | __SYSCALL(__NR_paccept, sys_paccept) |
644 | #define __NR_signalfd4 289 | ||
645 | __SYSCALL(__NR_signalfd4, sys_signalfd4) | ||
644 | 646 | ||
645 | 647 | ||
646 | #ifndef __NO_STUBS | 648 | #ifndef __NO_STUBS |
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h index ea037f28df91..8b3f7b7420a1 100644 --- a/include/linux/signalfd.h +++ b/include/linux/signalfd.h | |||
@@ -8,6 +8,11 @@ | |||
8 | #ifndef _LINUX_SIGNALFD_H | 8 | #ifndef _LINUX_SIGNALFD_H |
9 | #define _LINUX_SIGNALFD_H | 9 | #define _LINUX_SIGNALFD_H |
10 | 10 | ||
11 | /* For O_CLOEXEC */ | ||
12 | #include <linux/fcntl.h> | ||
13 | |||
14 | /* Flags for signalfd4. */ | ||
15 | #define SFD_CLOEXEC O_CLOEXEC | ||
11 | 16 | ||
12 | struct signalfd_siginfo { | 17 | struct signalfd_siginfo { |
13 | __u32 ssi_signo; | 18 | __u32 ssi_signo; |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 2a2a40af6b2c..1c2707797845 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -610,6 +610,7 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, | |||
610 | size_t len); | 610 | size_t len); |
611 | asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); | 611 | asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); |
612 | asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask); | 612 | asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask); |
613 | asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, size_t sizemask, int flags); | ||
613 | asmlinkage long sys_timerfd_create(int clockid, int flags); | 614 | asmlinkage long sys_timerfd_create(int clockid, int flags); |
614 | asmlinkage long sys_timerfd_settime(int ufd, int flags, | 615 | asmlinkage long sys_timerfd_settime(int ufd, int flags, |
615 | const struct itimerspec __user *utmr, | 616 | const struct itimerspec __user *utmr, |
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index 2f0b8a2e600f..8627c89ae9e8 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c | |||
@@ -156,6 +156,7 @@ cond_syscall(sys_ioprio_get); | |||
156 | 156 | ||
157 | /* New file descriptors */ | 157 | /* New file descriptors */ |
158 | cond_syscall(sys_signalfd); | 158 | cond_syscall(sys_signalfd); |
159 | cond_syscall(sys_signalfd4); | ||
159 | cond_syscall(compat_sys_signalfd); | 160 | cond_syscall(compat_sys_signalfd); |
160 | cond_syscall(sys_timerfd_create); | 161 | cond_syscall(sys_timerfd_create); |
161 | cond_syscall(sys_timerfd_settime); | 162 | cond_syscall(sys_timerfd_settime); |