Skip to content

Commit

Permalink
shmat(2): move compat to native
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jul 16, 2017
1 parent 9b1404c commit a78ee9e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
16 changes: 0 additions & 16 deletions ipc/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions ipc/shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a78ee9e

Please sign in to comment.