summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-07-09 10:38:28 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-07-15 20:46:47 -0400
commita78ee9ed2f828e1960f366bf7ab204e7f19924c7 (patch)
tree4404d3fe1a46a34c28028df0826dfa71ccf356bc
parent9b1404c24a357332cb2a6df7c4337e943a4545fd (diff)
shmat(2): move compat to native
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--ipc/compat.c16
-rw-r--r--ipc/shm.c19
2 files changed, 19 insertions, 16 deletions
diff --git a/ipc/compat.c b/ipc/compat.c
index 0586687c3e31..871d07da0a52 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -80,22 +80,6 @@ void to_compat_ipc_perm(struct compat_ipc_perm *to, struct ipc64_perm *from)
80 to->seq = from->seq; 80 to->seq = from->seq;
81} 81}
82 82
83#ifndef COMPAT_SHMLBA
84#define COMPAT_SHMLBA SHMLBA
85#endif
86
87COMPAT_SYSCALL_DEFINE3(shmat, int, shmid, compat_uptr_t, shmaddr, int, shmflg)
88{
89 unsigned long ret;
90 long err;
91
92 err = do_shmat(shmid, compat_ptr(shmaddr), shmflg, &ret, COMPAT_SHMLBA);
93 if (err)
94 return err;
95 force_successful_syscall_return();
96 return (long)ret;
97}
98
99COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems, 83COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems,
100 unsigned, nsops, 84 unsigned, nsops,
101 const struct compat_timespec __user *, timeout) 85 const struct compat_timespec __user *, timeout)
diff --git a/ipc/shm.c b/ipc/shm.c
index 2e31545035a6..342024de3b9d 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1439,6 +1439,25 @@ SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
1439 return (long)ret; 1439 return (long)ret;
1440} 1440}
1441 1441
1442#ifdef CONFIG_COMPAT
1443
1444#ifndef COMPAT_SHMLBA
1445#define COMPAT_SHMLBA SHMLBA
1446#endif
1447
1448COMPAT_SYSCALL_DEFINE3(shmat, int, shmid, compat_uptr_t, shmaddr, int, shmflg)
1449{
1450 unsigned long ret;
1451 long err;
1452
1453 err = do_shmat(shmid, compat_ptr(shmaddr), shmflg, &ret, COMPAT_SHMLBA);
1454 if (err)
1455 return err;
1456 force_successful_syscall_return();
1457 return (long)ret;
1458}
1459#endif
1460
1442/* 1461/*
1443 * detach and kill segment if marked destroyed. 1462 * detach and kill segment if marked destroyed.
1444 * The work is done in shm_close. 1463 * The work is done in shm_close.