Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile

Pull arch/tile (really asm-generic) update from Chris Metcalf:
 "These are a couple of asm-generic changes that apply to tile."

* git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
  compat: use sys_sendfile64() implementation for sendfile syscall
  [PATCH v3] ipc: provide generic compat versions of IPC syscalls
This commit is contained in:
Linus Torvalds 2012-03-29 14:49:45 -07:00
commit 50483c3268
11 changed files with 84 additions and 62 deletions

View file

@ -27,6 +27,7 @@
#include <linux/msg.h>
#include <linux/shm.h>
#include <linux/syscalls.h>
#include <linux/ptrace.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
@ -117,6 +118,7 @@ extern int sem_ctls[];
static inline int compat_ipc_parse_version(int *cmd)
{
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
int version = *cmd & IPC_64;
/* this is tricky: architectures that have support for the old
@ -128,6 +130,10 @@ static inline int compat_ipc_parse_version(int *cmd)
*cmd &= ~IPC_64;
#endif
return version;
#else
/* With the asm-generic APIs, we always use the 64-bit versions. */
return IPC_64;
#endif
}
static inline int __get_compat_ipc64_perm(struct ipc64_perm *p64,
@ -232,10 +238,9 @@ static inline int put_compat_semid_ds(struct semid64_ds *s,
return err;
}
long compat_sys_semctl(int first, int second, int third, void __user *uptr)
static long do_compat_semctl(int first, int second, int third, u32 pad)
{
union semun fourth;
u32 pad;
int err, err2;
struct semid64_ds s64;
struct semid64_ds __user *up64;
@ -243,10 +248,6 @@ long compat_sys_semctl(int first, int second, int third, void __user *uptr)
memset(&s64, 0, sizeof(s64));
if (!uptr)
return -EINVAL;
if (get_user(pad, (u32 __user *) uptr))
return -EFAULT;
if ((third & (~IPC_64)) == SETVAL)
fourth.val = (int) pad;
else
@ -305,6 +306,18 @@ long compat_sys_semctl(int first, int second, int third, void __user *uptr)
return err;
}
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
long compat_sys_semctl(int first, int second, int third, void __user *uptr)
{
u32 pad;
if (!uptr)
return -EINVAL;
if (get_user(pad, (u32 __user *) uptr))
return -EFAULT;
return do_compat_semctl(first, second, third, pad);
}
long compat_sys_msgsnd(int first, int second, int third, void __user *uptr)
{
struct compat_msgbuf __user *up = uptr;
@ -353,6 +366,37 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
out:
return err;
}
#else
long compat_sys_semctl(int semid, int semnum, int cmd, int arg)
{
return do_compat_semctl(semid, semnum, cmd, arg);
}
long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
size_t msgsz, int msgflg)
{
compat_long_t mtype;
if (get_user(mtype, &msgp->mtype))
return -EFAULT;
return do_msgsnd(msqid, mtype, msgp->mtext, msgsz, msgflg);
}
long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp,
size_t msgsz, long msgtyp, int msgflg)
{
long err, mtype;
err = do_msgrcv(msqid, &mtype, msgp->mtext, msgsz, msgtyp, msgflg);
if (err < 0)
goto out;
if (put_user(mtype, &msgp->mtype))
err = -EFAULT;
out:
return err;
}
#endif
static inline int get_compat_msqid64(struct msqid64_ds *m64,
struct compat_msqid64_ds __user *up64)
@ -470,6 +514,7 @@ long compat_sys_msgctl(int first, int second, void __user *uptr)
return err;
}
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
void __user *uptr)
{
@ -485,6 +530,19 @@ long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
uaddr = compat_ptr(third);
return put_user(raddr, uaddr);
}
#else
long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg)
{
unsigned long ret;
long err;
err = do_shmat(shmid, compat_ptr(shmaddr), shmflg, &ret);
if (err)
return err;
force_successful_syscall_return();
return (long)ret;
}
#endif
static inline int get_compat_shmid64_ds(struct shmid64_ds *s64,
struct compat_shmid64_ds __user *up64)