#include <linux/shmem_fs.h>
#include <linux/security.h>
#include <linux/vs_base.h>
-#include <linux/syscalls.h>
#include <asm/uaccess.h>
return -ENOMEM;
shp->shm_perm.key = key;
- shp->shm_perm.xid = vx_current_xid();
+ shp->shm_perm.xid = current->xid;
shp->shm_flags = (shmflg & S_IRWXUGO);
shp->mlock_user = NULL;
case SHM_LOCK:
case SHM_UNLOCK:
{
+ /* Allow superuser to lock segment in memory */
+ if (!can_do_mlock() && cmd == SHM_LOCK) {
+ err = -EPERM;
+ goto out;
+ }
shp = shm_lock(shmid);
if(shp==NULL) {
err = -EINVAL;
if(err)
goto out_unlock;
- if (!capable(CAP_IPC_LOCK)) {
- err = -EPERM;
- if (current->euid != shp->shm_perm.uid &&
- current->euid != shp->shm_perm.cuid)
- goto out_unlock;
- if (cmd == SHM_LOCK &&
- !current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur)
- goto out_unlock;
- }
-
err = security_shm_shmctl(shp, cmd);
if (err)
goto out_unlock;