aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat.c
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 /fs/compat.c
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 'fs/compat.c')
-rw-r--r--fs/compat.c121
1 files changed, 0 insertions, 121 deletions
diff --git a/fs/compat.c b/fs/compat.c
index d487985dd0ea..5f83ffa42115 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -44,7 +44,6 @@
44#include <linux/signal.h> 44#include <linux/signal.h>
45#include <linux/poll.h> 45#include <linux/poll.h>
46#include <linux/mm.h> 46#include <linux/mm.h>
47#include <linux/eventpoll.h>
48#include <linux/fs_struct.h> 47#include <linux/fs_struct.h>
49#include <linux/slab.h> 48#include <linux/slab.h>
50#include <linux/pagemap.h> 49#include <linux/pagemap.h>
@@ -1253,26 +1252,6 @@ compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
1253 return compat_sys_pwritev64(fd, vec, vlen, pos); 1252 return compat_sys_pwritev64(fd, vec, vlen, pos);
1254} 1253}
1255 1254
1256asmlinkage long
1257compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
1258 unsigned int nr_segs, unsigned int flags)
1259{
1260 unsigned i;
1261 struct iovec __user *iov;
1262 if (nr_segs > UIO_MAXIOV)
1263 return -EINVAL;
1264 iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec));
1265 for (i = 0; i < nr_segs; i++) {
1266 struct compat_iovec v;
1267 if (get_user(v.iov_base, &iov32[i].iov_base) ||
1268 get_user(v.iov_len, &iov32[i].iov_len) ||
1269 put_user(compat_ptr(v.iov_base), &iov[i].iov_base) ||
1270 put_user(v.iov_len, &iov[i].iov_len))
1271 return -EFAULT;
1272 }
1273 return sys_vmsplice(fd, iov, nr_segs, flags);
1274}
1275
1276/* 1255/*
1277 * Exactly like fs/open.c:sys_open(), except that it doesn't set the 1256 * Exactly like fs/open.c:sys_open(), except that it doesn't set the
1278 * O_LARGEFILE flag. 1257 * O_LARGEFILE flag.
@@ -1658,84 +1637,6 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
1658 return ret; 1637 return ret;
1659} 1638}
1660 1639
1661#ifdef CONFIG_EPOLL
1662
1663asmlinkage long compat_sys_epoll_pwait(int epfd,
1664 struct compat_epoll_event __user *events,
1665 int maxevents, int timeout,
1666 const compat_sigset_t __user *sigmask,
1667 compat_size_t sigsetsize)
1668{
1669 long err;
1670 compat_sigset_t csigmask;
1671 sigset_t ksigmask, sigsaved;
1672
1673 /*
1674 * If the caller wants a certain signal mask to be set during the wait,
1675 * we apply it here.
1676 */
1677 if (sigmask) {
1678 if (sigsetsize != sizeof(compat_sigset_t))
1679 return -EINVAL;
1680 if (copy_from_user(&csigmask, sigmask, sizeof(csigmask)))
1681 return -EFAULT;
1682 sigset_from_compat(&ksigmask, &csigmask);
1683 sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
1684 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
1685 }
1686
1687 err = sys_epoll_wait(epfd, events, maxevents, timeout);
1688
1689 /*
1690 * If we changed the signal mask, we need to restore the original one.
1691 * In case we've got a signal while waiting, we do not restore the
1692 * signal mask yet, and we allow do_signal() to deliver the signal on
1693 * the way back to userspace, before the signal mask is restored.
1694 */
1695 if (sigmask) {
1696 if (err == -EINTR) {
1697 memcpy(&current->saved_sigmask, &sigsaved,
1698 sizeof(sigsaved));
1699 set_restore_sigmask();
1700 } else
1701 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
1702 }
1703
1704 return err;
1705}
1706
1707#endif /* CONFIG_EPOLL */
1708
1709#ifdef CONFIG_SIGNALFD
1710
1711asmlinkage long compat_sys_signalfd4(int ufd,
1712 const compat_sigset_t __user *sigmask,
1713 compat_size_t sigsetsize, int flags)
1714{
1715 compat_sigset_t ss32;
1716 sigset_t tmp;
1717 sigset_t __user *ksigmask;
1718
1719 if (sigsetsize != sizeof(compat_sigset_t))
1720 return -EINVAL;
1721 if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
1722 return -EFAULT;
1723 sigset_from_compat(&tmp, &ss32);
1724 ksigmask = compat_alloc_user_space(sizeof(sigset_t));
1725 if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t)))
1726 return -EFAULT;
1727
1728 return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags);
1729}
1730
1731asmlinkage long compat_sys_signalfd(int ufd,
1732 const compat_sigset_t __user *sigmask,
1733 compat_size_t sigsetsize)
1734{
1735 return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0);
1736}
1737#endif /* CONFIG_SIGNALFD */
1738
1739#ifdef CONFIG_FHANDLE 1640#ifdef CONFIG_FHANDLE
1740/* 1641/*
1741 * Exactly like fs/open.c:sys_open_by_handle_at(), except that it 1642 * Exactly like fs/open.c:sys_open_by_handle_at(), except that it
@@ -1747,25 +1648,3 @@ COMPAT_SYSCALL_DEFINE3(open_by_handle_at, int, mountdirfd,
1747 return do_handle_open(mountdirfd, handle, flags); 1648 return do_handle_open(mountdirfd, handle, flags);
1748} 1649}
1749#endif 1650#endif
1750
1751#ifdef __ARCH_WANT_COMPAT_SYS_SENDFILE
1752asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
1753 compat_off_t __user *offset, compat_size_t count)
1754{
1755 loff_t pos;
1756 off_t off;
1757 ssize_t ret;
1758
1759 if (offset) {
1760 if (unlikely(get_user(off, offset)))
1761 return -EFAULT;
1762 pos = off;
1763 ret = do_sendfile(out_fd, in_fd, &pos, count, MAX_NON_LFS);
1764 if (unlikely(put_user(pos, offset)))
1765 return -EFAULT;
1766 return ret;
1767 }
1768
1769 return do_sendfile(out_fd, in_fd, NULL, count, 0);
1770}
1771#endif /* __ARCH_WANT_COMPAT_SYS_SENDFILE */