aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-02-24 01:41:39 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-03-03 22:58:46 -0500
commit7d197ed4a68e76000070979563051e08bf6fc0aa (patch)
treead74a62a2808db635a954c571d8b9a59bb4cf43c /fs
parent2cf0966683430b6468f36ca20515a33ca7f2403c (diff)
switch signalfd{,4}() to COMPAT_SYSCALL_DEFINE
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/compat.c30
-rw-r--r--fs/signalfd.c31
2 files changed, 31 insertions, 30 deletions
diff --git a/fs/compat.c b/fs/compat.c
index fe40fde29111..cc09312f9aed 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1707,36 +1707,6 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
1707 1707
1708#endif /* CONFIG_EPOLL */ 1708#endif /* CONFIG_EPOLL */
1709 1709
1710#ifdef CONFIG_SIGNALFD
1711
1712asmlinkage long compat_sys_signalfd4(int ufd,
1713 const compat_sigset_t __user *sigmask,
1714 compat_size_t sigsetsize, int flags)
1715{
1716 compat_sigset_t ss32;
1717 sigset_t tmp;
1718 sigset_t __user *ksigmask;
1719
1720 if (sigsetsize != sizeof(compat_sigset_t))
1721 return -EINVAL;
1722 if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
1723 return -EFAULT;
1724 sigset_from_compat(&tmp, &ss32);
1725 ksigmask = compat_alloc_user_space(sizeof(sigset_t));
1726 if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t)))
1727 return -EFAULT;
1728
1729 return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags);
1730}
1731
1732asmlinkage long compat_sys_signalfd(int ufd,
1733 const compat_sigset_t __user *sigmask,
1734 compat_size_t sigsetsize)
1735{
1736 return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0);
1737}
1738#endif /* CONFIG_SIGNALFD */
1739
1740#ifdef CONFIG_FHANDLE 1710#ifdef CONFIG_FHANDLE
1741/* 1711/*
1742 * Exactly like fs/open.c:sys_open_by_handle_at(), except that it 1712 * Exactly like fs/open.c:sys_open_by_handle_at(), except that it
diff --git a/fs/signalfd.c b/fs/signalfd.c
index b53486961735..424b7b65321f 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -30,6 +30,7 @@
30#include <linux/signalfd.h> 30#include <linux/signalfd.h>
31#include <linux/syscalls.h> 31#include <linux/syscalls.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/compat.h>
33 34
34void signalfd_cleanup(struct sighand_struct *sighand) 35void signalfd_cleanup(struct sighand_struct *sighand)
35{ 36{
@@ -311,3 +312,33 @@ SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
311{ 312{
312 return sys_signalfd4(ufd, user_mask, sizemask, 0); 313 return sys_signalfd4(ufd, user_mask, sizemask, 0);
313} 314}
315
316#ifdef CONFIG_COMPAT
317COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd,
318 const compat_sigset_t __user *,sigmask,
319 compat_size_t, sigsetsize,
320 int, flags)
321{
322 compat_sigset_t ss32;
323 sigset_t tmp;
324 sigset_t __user *ksigmask;
325
326 if (sigsetsize != sizeof(compat_sigset_t))
327 return -EINVAL;
328 if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
329 return -EFAULT;
330 sigset_from_compat(&tmp, &ss32);
331 ksigmask = compat_alloc_user_space(sizeof(sigset_t));
332 if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t)))
333 return -EFAULT;
334
335 return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags);
336}
337
338COMPAT_SYSCALL_DEFINE3(signalfd, int, ufd,
339 const compat_sigset_t __user *,sigmask,
340 compat_size_t, sigsetsize)
341{
342 return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0);
343}
344#endif