merge compat sys_ipc instances
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 22 Jan 2013 04:15:25 +0000 (23:15 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 4 Mar 2013 04:00:27 +0000 (23:00 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
15 files changed:
arch/mips/kernel/linux32.c
arch/mips/kernel/scall64-o32.S
arch/powerpc/kernel/sys_ppc32.c
arch/s390/kernel/compat_linux.c
arch/s390/kernel/compat_linux.h
arch/s390/kernel/compat_wrapper.S
arch/s390/kernel/syscalls.S
arch/sparc/kernel/sys_sparc32.c
arch/x86/ia32/Makefile
arch/x86/ia32/ipc32.c [deleted file]
arch/x86/include/asm/sys_ia32.h
arch/x86/syscalls/syscall_32.tbl
include/linux/compat.h
ipc/compat.c
kernel/sys_ni.c

index 6852d4876f825bd5ad3fa1aae18b7eaa59fbdd5d..7c57b8d7b2553d4539b0b071852f722170771319 100644 (file)
@@ -119,75 +119,6 @@ SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,
        return sys_pwrite64(fd, buf, count, merge_64(a4, a5));
 }
 
-#ifdef CONFIG_SYSVIPC
-
-SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third,
-       unsigned long, ptr, unsigned long, fifth)
-{
-       int version, err;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               /* struct sembuf is the same on 32 and 64bit :)) */
-               err = sys_semtimedop(first, compat_ptr(ptr), second, NULL);
-               break;
-       case SEMTIMEDOP:
-               err = compat_sys_semtimedop(first, compat_ptr(ptr), second,
-                                           compat_ptr(fifth));
-               break;
-       case SEMGET:
-               err = sys_semget(first, second, third);
-               break;
-       case SEMCTL:
-               err = compat_sys_semctl(first, second, third, compat_ptr(ptr));
-               break;
-       case MSGSND:
-               err = compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
-               break;
-       case MSGRCV:
-               err = compat_sys_msgrcv(first, second, fifth, third,
-                                       version, compat_ptr(ptr));
-               break;
-       case MSGGET:
-               err = sys_msgget((key_t) first, second);
-               break;
-       case MSGCTL:
-               err = compat_sys_msgctl(first, second, compat_ptr(ptr));
-               break;
-       case SHMAT:
-               err = compat_sys_shmat(first, second, third, version,
-                                      compat_ptr(ptr));
-               break;
-       case SHMDT:
-               err = sys_shmdt(compat_ptr(ptr));
-               break;
-       case SHMGET:
-               err = sys_shmget(first, (unsigned)second, third);
-               break;
-       case SHMCTL:
-               err = compat_sys_shmctl(first, second, compat_ptr(ptr));
-               break;
-       default:
-               err = -EINVAL;
-               break;
-       }
-
-       return err;
-}
-
-#else
-
-SYSCALL_DEFINE6(32_ipc, u32, call, int, first, int, second, int, third,
-       u32, ptr, u32, fifth)
-{
-       return -ENOSYS;
-}
-
-#endif /* CONFIG_SYSVIPC */
-
 #ifdef CONFIG_MIPS32_N32
 SYSCALL_DEFINE4(n32_semctl, int, semid, int, semnum, int, cmd, u32, arg)
 {
index 91c8c6ea7b09a96e0fd519adb1c7ef71cd2ed92b..103bfe570fe8ee375d94732b074efee7723ec550 100644 (file)
@@ -309,7 +309,7 @@ sys_call_table:
        PTR     compat_sys_wait4
        PTR     sys_swapoff                     /* 4115 */
        PTR     compat_sys_sysinfo
-       PTR     sys_32_ipc
+       PTR     compat_sys_ipc
        PTR     sys_fsync
        PTR     sys32_sigreturn
        PTR     __sys_clone                     /* 4120 */
index e695230ca181025a4e590ad79c145424f34b74d0..d78ad7b6c46409e5734bc31ddd0f666272401442 100644 (file)
@@ -61,73 +61,6 @@ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
        return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x));
 }
 
-#ifdef CONFIG_SYSVIPC
-long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
-              u32 fifth)
-{
-       int version;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-
-       case SEMTIMEDOP:
-               if (fifth)
-                       /* sign extend semid */
-                       return compat_sys_semtimedop((int)first,
-                                                    compat_ptr(ptr), second,
-                                                    compat_ptr(fifth));
-               /* else fall through for normal semop() */
-       case SEMOP:
-               /* struct sembuf is the same on 32 and 64bit :)) */
-               /* sign extend semid */
-               return sys_semtimedop((int)first, compat_ptr(ptr), second,
-                                     NULL);
-       case SEMGET:
-               /* sign extend key, nsems */
-               return sys_semget((int)first, (int)second, third);
-       case SEMCTL:
-               /* sign extend semid, semnum */
-               return compat_sys_semctl((int)first, (int)second, third,
-                                        compat_ptr(ptr));
-
-       case MSGSND:
-               /* sign extend msqid */
-               return compat_sys_msgsnd((int)first, (int)second, third,
-                                        compat_ptr(ptr));
-       case MSGRCV:
-               /* sign extend msqid, msgtyp */
-               return compat_sys_msgrcv((int)first, second, (int)fifth,
-                                        third, version, compat_ptr(ptr));
-       case MSGGET:
-               /* sign extend key */
-               return sys_msgget((int)first, second);
-       case MSGCTL:
-               /* sign extend msqid */
-               return compat_sys_msgctl((int)first, second, compat_ptr(ptr));
-
-       case SHMAT:
-               /* sign extend shmid */
-               return compat_sys_shmat((int)first, second, third, version,
-                                       compat_ptr(ptr));
-       case SHMDT:
-               return sys_shmdt(compat_ptr(ptr));
-       case SHMGET:
-               /* sign extend key_t */
-               return sys_shmget((int)first, second, third);
-       case SHMCTL:
-               /* sign extend shmid */
-               return compat_sys_shmctl((int)first, second, compat_ptr(ptr));
-
-       default:
-               return -ENOSYS;
-       }
-
-       return -ENOSYS;
-}
-#endif
-
 unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
                          unsigned long prot, unsigned long flags,
                          unsigned long fd, unsigned long pgoff)
index fbd29c70a297bb863c396835693e98dd77846c18..8b6e4f5288a29cc155fb1a3f20d46c08da38be07 100644 (file)
@@ -288,51 +288,13 @@ asmlinkage long sys32_getegid16(void)
        return high2lowgid(from_kgid_munged(current_user_ns(), current_egid()));
 }
 
-/*
- * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation.
- *
- * This is really horribly ugly.
- */
 #ifdef CONFIG_SYSVIPC
-asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr)
+COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
+               unsigned long, third, compat_uptr_t, ptr)
 {
        if (call >> 16)         /* hack for backward compatibility */
                return -EINVAL;
-       switch (call) {
-       case SEMTIMEDOP:
-               return compat_sys_semtimedop(first, compat_ptr(ptr),
-                                            second, compat_ptr(third));
-       case SEMOP:
-               /* struct sembuf is the same on 32 and 64bit :)) */
-               return sys_semtimedop(first, compat_ptr(ptr),
-                                     second, NULL);
-       case SEMGET:
-               return sys_semget(first, second, third);
-       case SEMCTL:
-               return compat_sys_semctl(first, second, third,
-                                        compat_ptr(ptr));
-       case MSGSND:
-               return compat_sys_msgsnd(first, second, third,
-                                        compat_ptr(ptr));
-       case MSGRCV:
-               return compat_sys_msgrcv(first, second, 0, third,
-                                        0, compat_ptr(ptr));
-       case MSGGET:
-               return sys_msgget((key_t) first, second);
-       case MSGCTL:
-               return compat_sys_msgctl(first, second, compat_ptr(ptr));
-       case SHMAT:
-               return compat_sys_shmat(first, second, third,
-                                       0, compat_ptr(ptr));
-       case SHMDT:
-               return sys_shmdt(compat_ptr(ptr));
-       case SHMGET:
-               return sys_shmget(first, (unsigned)second, third);
-       case SHMCTL:
-               return compat_sys_shmctl(first, second, compat_ptr(ptr));
-       }
-
-       return -ENOSYS;
+       return compat_sys_ipc(call, first, second, third, ptr, third);
 }
 #endif
 
index bce0b7aec8f9b6c5f8b70f068fd0a8f44e61a070..976518c0592aa96a29565bac78d58fa8fcfdd846 100644 (file)
@@ -94,7 +94,6 @@ long sys32_getuid16(void);
 long sys32_geteuid16(void);
 long sys32_getgid16(void);
 long sys32_getegid16(void);
-long sys32_ipc(u32 call, int first, int second, int third, u32 ptr);
 long sys32_truncate64(const char __user * path, unsigned long high,
                      unsigned long low);
 long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low);
index 6d4958ea390b47f32e94fe0d9e4eb2f2eab65c81..17644c8e10e189856b902fbf4fc38320680217ce 100644 (file)
@@ -388,14 +388,6 @@ ENTRY(compat_sys_sysinfo_wrapper)
        llgtr   %r2,%r2                 # struct sysinfo_emu31 *
        jg      compat_sys_sysinfo      # branch to system call
 
-ENTRY(sys32_ipc_wrapper)
-       llgfr   %r2,%r2                 # uint
-       lgfr    %r3,%r3                 # int
-       lgfr    %r4,%r4                 # int
-       lgfr    %r5,%r5                 # int
-       llgfr   %r6,%r6                 # u32
-       jg      sys32_ipc               # branch to system call
-
 ENTRY(sys32_fsync_wrapper)
        llgfr   %r2,%r2                 # unsigned int
        jg      sys_fsync               # branch to system call
index 9154e17f25b9a66cdb3a2a9be2451bb2533ce938..d2baabed7148b22adef307256f823043c7aa2f93 100644 (file)
@@ -125,7 +125,7 @@ NI_SYSCALL                                                  /* vm86old for i386 */
 SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4)
 SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper)         /* 115 */
 SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
-SYSCALL(sys_s390_ipc,sys_s390_ipc,sys32_ipc_wrapper)
+SYSCALL(sys_s390_ipc,sys_s390_ipc,compat_sys_s390_ipc)
 SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
 SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
 SYSCALL(sys_clone,sys_clone,sys_clone_wrapper)                 /* 120 */
index 5d4ee8374c84bf678ba71ad047b00d79875e9bf8..d546188b13df56e2a6d491f99993641b0c206fba 100644 (file)
 #include <asm/mmu_context.h>
 #include <asm/compat_signal.h>
 
-#ifdef CONFIG_SYSVIPC                                                        
-asmlinkage long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, u32 fifth)
-{
-       int version;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMTIMEDOP:
-               if (fifth)
-                       /* sign extend semid */
-                       return compat_sys_semtimedop((int)first,
-                                                    compat_ptr(ptr), second,
-                                                    compat_ptr(fifth));
-               /* else fall through for normal semop() */
-       case SEMOP:
-               /* struct sembuf is the same on 32 and 64bit :)) */
-               /* sign extend semid */
-               return sys_semtimedop((int)first, compat_ptr(ptr), second,
-                                     NULL);
-       case SEMGET:
-               /* sign extend key, nsems */
-               return sys_semget((int)first, (int)second, third);
-       case SEMCTL:
-               /* sign extend semid, semnum */
-               return compat_sys_semctl((int)first, (int)second, third,
-                                        compat_ptr(ptr));
-
-       case MSGSND:
-               /* sign extend msqid */
-               return compat_sys_msgsnd((int)first, (int)second, third,
-                                        compat_ptr(ptr));
-       case MSGRCV:
-               /* sign extend msqid, msgtyp */
-               return compat_sys_msgrcv((int)first, second, (int)fifth,
-                                        third, version, compat_ptr(ptr));
-       case MSGGET:
-               /* sign extend key */
-               return sys_msgget((int)first, second);
-       case MSGCTL:
-               /* sign extend msqid */
-               return compat_sys_msgctl((int)first, second, compat_ptr(ptr));
-
-       case SHMAT:
-               /* sign extend shmid */
-               return compat_sys_shmat((int)first, second, third, version,
-                                       compat_ptr(ptr));
-       case SHMDT:
-               return sys_shmdt(compat_ptr(ptr));
-       case SHMGET:
-               /* sign extend key_t */
-               return sys_shmget((int)first, second, third);
-       case SHMCTL:
-               /* sign extend shmid */
-               return compat_sys_shmctl((int)first, second, compat_ptr(ptr));
-
-       default:
-               return -ENOSYS;
-       }
-
-       return -ENOSYS;
-}
-#endif
-
 asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
 {
        if ((int)high < 0)
index 455646e0e53282ad97721c4c04420de09e36f3d2..e785b422b76686b3bf79d95be5aebd20b961cef8 100644 (file)
@@ -5,9 +5,6 @@
 obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o
 obj-$(CONFIG_IA32_EMULATION) += nosyscall.o syscall_ia32.o
 
-sysv-$(CONFIG_SYSVIPC) := ipc32.o
-obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
-
 obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
 
 audit-class-$(CONFIG_AUDIT) := audit.o
diff --git a/arch/x86/ia32/ipc32.c b/arch/x86/ia32/ipc32.c
deleted file mode 100644 (file)
index 29cdcd0..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <linux/kernel.h>
-#include <linux/spinlock.h>
-#include <linux/list.h>
-#include <linux/syscalls.h>
-#include <linux/time.h>
-#include <linux/sem.h>
-#include <linux/msg.h>
-#include <linux/shm.h>
-#include <linux/ipc.h>
-#include <linux/compat.h>
-#include <asm/sys_ia32.h>
-
-asmlinkage long sys32_ipc(u32 call, int first, int second, int third,
-                         compat_uptr_t ptr, u32 fifth)
-{
-       int version;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               /* struct sembuf is the same on 32 and 64bit :)) */
-               return sys_semtimedop(first, compat_ptr(ptr), second, NULL);
-       case SEMTIMEDOP:
-               return compat_sys_semtimedop(first, compat_ptr(ptr), second,
-                                               compat_ptr(fifth));
-       case SEMGET:
-               return sys_semget(first, second, third);
-       case SEMCTL:
-               return compat_sys_semctl(first, second, third, compat_ptr(ptr));
-
-       case MSGSND:
-               return compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
-       case MSGRCV:
-               return compat_sys_msgrcv(first, second, fifth, third,
-                                        version, compat_ptr(ptr));
-       case MSGGET:
-               return sys_msgget((key_t) first, second);
-       case MSGCTL:
-               return compat_sys_msgctl(first, second, compat_ptr(ptr));
-
-       case SHMAT:
-               return compat_sys_shmat(first, second, third, version,
-                                       compat_ptr(ptr));
-       case SHMDT:
-               return sys_shmdt(compat_ptr(ptr));
-       case SHMGET:
-               return sys_shmget(first, (unsigned)second, third);
-       case SHMCTL:
-               return compat_sys_shmctl(first, second, compat_ptr(ptr));
-       }
-       return -ENOSYS;
-}
index 2b0e0c2d53799e35ab09714317401184f7894b4e..df8ad3b3920a1108db55aebb9107cccca15cc37e 100644 (file)
@@ -57,9 +57,6 @@ asmlinkage long sys32_fallocate(int, int, unsigned,
 asmlinkage long sys32_sigreturn(void);
 asmlinkage long sys32_rt_sigreturn(void);
 
-/* ia32/ipc32.c */
-asmlinkage long sys32_ipc(u32, int, int, int, compat_uptr_t, u32);
-
 asmlinkage long sys32_fanotify_mark(int, unsigned int, u32, u32, int,
                                    const char __user *);
 
index 0b55cd773e4cf3fd043c6c8e4e702d225965ce26..0f6f5becab0d555a3dfbd874a3f5b784a0ccf47f 100644 (file)
 114    i386    wait4                   sys_wait4                       compat_sys_wait4
 115    i386    swapoff                 sys_swapoff
 116    i386    sysinfo                 sys_sysinfo                     compat_sys_sysinfo
-117    i386    ipc                     sys_ipc                         sys32_ipc
+117    i386    ipc                     sys_ipc                         compat_sys_ipc
 118    i386    fsync                   sys_fsync
 119    i386    sigreturn               sys_sigreturn                   stub32_sigreturn
 120    i386    clone                   sys_clone                       stub32_clone
index 482c9e65b5bf4eb3d8453b1957fbea0c5aab31b3..79a4781ac502ee300810fd425d850330d01269d5 100644 (file)
@@ -318,6 +318,7 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
                int version, void __user *uptr);
 long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
                void __user *uptr);
+asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
 #else
 long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
 long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
index 2547f29dcd1b5e00ab93ed37c594e93d6e1f5b75..1da2e2eb9d7062e5988d70e5969904dc1ad963d2 100644 (file)
@@ -368,6 +368,50 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
        return do_msgrcv(first, uptr, second, msgtyp, third,
                         compat_do_msg_fill);
 }
+
+COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
+       u32, third, compat_uptr_t, ptr, u32, fifth)
+{
+       int version;
+
+       version = call >> 16; /* hack for backward compatibility */
+       call &= 0xffff;
+
+       switch (call) {
+       case SEMOP:
+               /* struct sembuf is the same on 32 and 64bit :)) */
+               return sys_semtimedop(first, compat_ptr(ptr), second, NULL);
+       case SEMTIMEDOP:
+               return compat_sys_semtimedop(first, compat_ptr(ptr), second,
+                                               compat_ptr(fifth));
+       case SEMGET:
+               return sys_semget(first, second, third);
+       case SEMCTL:
+               return compat_sys_semctl(first, second, third, compat_ptr(ptr));
+
+       case MSGSND:
+               return compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
+       case MSGRCV:
+               return compat_sys_msgrcv(first, second, fifth, third,
+                                        version, compat_ptr(ptr));
+       case MSGGET:
+               return sys_msgget(first, second);
+       case MSGCTL:
+               return compat_sys_msgctl(first, second, compat_ptr(ptr));
+
+       case SHMAT:
+               return compat_sys_shmat(first, second, third, version,
+                                       compat_ptr(ptr));
+       case SHMDT:
+               return sys_shmdt(compat_ptr(ptr));
+       case SHMGET:
+               return sys_shmget(first, (unsigned)second, third);
+       case SHMCTL:
+               return compat_sys_shmctl(first, second, compat_ptr(ptr));
+       }
+
+       return -ENOSYS;
+}
 #else
 long compat_sys_semctl(int semid, int semnum, int cmd, int arg)
 {
index b50e2a003c5aa513c977fb0bf657206f94f50708..bfd6787b355a13813cb0b19c018d47a46f2bba8a 100644 (file)
@@ -156,7 +156,7 @@ cond_syscall(compat_sys_process_vm_writev);
 cond_syscall(sys_pciconfig_read);
 cond_syscall(sys_pciconfig_write);
 cond_syscall(sys_pciconfig_iobase);
-cond_syscall(sys32_ipc);
+cond_syscall(compat_sys_s390_ipc);
 cond_syscall(ppc_rtas);
 cond_syscall(sys_spu_run);
 cond_syscall(sys_spu_create);