shmat(2): move compat to native
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 9 Jul 2017 14:38:28 +0000 (10:38 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 16 Jul 2017 00:46:47 +0000 (20:46 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
ipc/compat.c
ipc/shm.c

index 0586687c3e3196628b01f3aa1d54e2b12445d5df..871d07da0a529423d38b83e24390793f71470930 100644 (file)
@@ -80,22 +80,6 @@ void to_compat_ipc_perm(struct compat_ipc_perm *to, struct ipc64_perm *from)
        to->seq = from->seq;
 }
 
-#ifndef COMPAT_SHMLBA
-#define COMPAT_SHMLBA  SHMLBA
-#endif
-
-COMPAT_SYSCALL_DEFINE3(shmat, int, shmid, compat_uptr_t, shmaddr, int, shmflg)
-{
-       unsigned long ret;
-       long err;
-
-       err = do_shmat(shmid, compat_ptr(shmaddr), shmflg, &ret, COMPAT_SHMLBA);
-       if (err)
-               return err;
-       force_successful_syscall_return();
-       return (long)ret;
-}
-
 COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems,
                       unsigned, nsops,
                       const struct compat_timespec __user *, timeout)
index 2e31545035a64c80a9f1798ea7635b9167491317..342024de3b9d205d9e74beeb3fcb01d3e7441d75 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1439,6 +1439,25 @@ SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
        return (long)ret;
 }
 
+#ifdef CONFIG_COMPAT
+
+#ifndef COMPAT_SHMLBA
+#define COMPAT_SHMLBA  SHMLBA
+#endif
+
+COMPAT_SYSCALL_DEFINE3(shmat, int, shmid, compat_uptr_t, shmaddr, int, shmflg)
+{
+       unsigned long ret;
+       long err;
+
+       err = do_shmat(shmid, compat_ptr(shmaddr), shmflg, &ret, COMPAT_SHMLBA);
+       if (err)
+               return err;
+       force_successful_syscall_return();
+       return (long)ret;
+}
+#endif
+
 /*
  * detach and kill segment if marked destroyed.
  * The work is done in shm_close.