--- olpc-2.6-master.00/include/linux/ipc.h 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/include/linux/ipc.h 2007-03-01 11:52:20.000000000 -0500 @@ -63,6 +63,7 @@ struct kern_ipc_perm key_t key; uid_t uid; gid_t gid; + xid_t xid; uid_t cuid; gid_t cgid; mode_t mode; --- olpc-2.6-master.00/ipc/msg.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/msg.c 2007-03-01 11:52:20.000000000 -0500 @@ -149,6 +150,7 @@ static int newque (struct ipc_namespace msq->q_perm.mode = msgflg & S_IRWXUGO; msq->q_perm.key = key; + msq->q_perm.xid = vx_current_xid(); msq->q_perm.security = NULL; retval = security_msg_queue_alloc(msq); --- olpc-2.6-master.00/ipc/mqueue.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/mqueue.c 2007-03-01 11:52:20.000000000 -0500 @@ -156,6 +159,7 @@ ***** goto out_inode; } u->mq_bytes += mq_bytes; + vx_ipcmsg_add(p->vx_info, u, mq_bytes); spin_unlock(&mq_lock); info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL); --- olpc-2.6-master.00/ipc/mqueue.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/mqueue.c 2007-03-01 11:52:20.000000000 -0500 @@ -162,6 +166,7 @@ ***** if (!info->messages) { spin_lock(&mq_lock); u->mq_bytes -= mq_bytes; + vx_ipcmsg_sub(p->vx_info, u, mq_bytes); spin_unlock(&mq_lock); goto out_inode; } --- olpc-2.6-master.00/ipc/sem.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/sem.c 2007-03-01 11:52:20.000000000 -0500 @@ -230,6 +232,7 @@ static int newary (struct ipc_namespace sma->sem_perm.mode = (semflg & S_IRWXUGO); sma->sem_perm.key = key; + sma->sem_perm.xid = vx_current_xid(); sma->sem_perm.security = NULL; retval = security_sem_alloc(sma); --- olpc-2.6-master.00/ipc/mqueue.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/mqueue.c 2007-03-01 11:52:20.000000000 -0500 @@ -151,7 +153,8 @@ static struct inode *mqueue_get_inode(st spin_lock(&mq_lock); if (u->mq_bytes + mq_bytes < u->mq_bytes || u->mq_bytes + mq_bytes > - p->signal->rlim[RLIMIT_MSGQUEUE].rlim_cur) { + p->signal->rlim[RLIMIT_MSGQUEUE].rlim_cur || + !vx_ipcmsg_avail(p->vx_info, mq_bytes)) { spin_unlock(&mq_lock); goto out_inode; } --- olpc-2.6-master.00/ipc/mqueue.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/mqueue.c 2007-03-01 11:52:20.000000000 -0500 @@ -259,10 +264,14 @@ static void mqueue_delete_inode(struct i (info->attr.mq_maxmsg * info->attr.mq_msgsize)); user = info->user; if (user) { + struct vx_info *vxi = lookup_vx_info(user->xid); + spin_lock(&mq_lock); user->mq_bytes -= mq_bytes; + vx_ipcmsg_sub(vxi, user, mq_bytes); queues_count--; spin_unlock(&mq_lock); + put_vx_info(vxi); free_uid(user); } } --- olpc-2.6-master.00/ipc/sem.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/sem.c 2007-03-01 11:52:20.000000000 -0500 @@ -245,6 +248,9 @@ static int newary (struct ipc_namespace return -ENOSPC; } ns->used_sems += nsems; + /* FIXME: obsoleted? */ + vx_semary_inc(sma); + vx_nsems_add(sma, nsems); sma->sem_id = sem_buildid(ns, id, sma->sem_perm.seq); sma->sem_base = (struct sem *) &sma[1]; --- olpc-2.6-master.00/ipc/sem.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/sem.c 2007-03-01 11:52:20.000000000 -0500 @@ -526,6 +532,9 @@ static void freeary (struct ipc_namespac sem_unlock(sma); ns->used_sems -= sma->sem_nsems; + /* FIXME: obsoleted? */ + vx_nsems_sub(sma, sma->sem_nsems); + vx_semary_dec(sma); size = sizeof (*sma) + sma->sem_nsems * sizeof (struct sem); security_sem_free(sma); ipc_rcu_putref(sma); --- olpc-2.6-master.00/ipc/shm.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/shm.c 2007-03-01 11:53:25.000000000 -0500 @@ -185,7 +187,12 @@ static void shm_open(struct vm_area_stru */ static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp) { - ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT; + struct vx_info *vxi = lookup_vx_info(shp->shm_perm.xid); + int numpages = (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT; + + vx_ipcshm_sub(vxi, shp, numpages); + ns->shm_tot -= numpages; + shm_rmid(ns, shp->id); shm_unlock(shp); if (!is_file_hugepages(shp->shm_file)) --- olpc-2.6-master.00/ipc/shm.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/shm.c 2007-03-01 11:53:25.000000000 -0500 @@ -195,6 +202,7 @@ static void shm_destroy(struct ipc_names shp->mlock_user); fput (shp->shm_file); security_shm_free(shp); + put_vx_info(vxi); ipc_rcu_putref(shp); } --- olpc-2.6-master.00/ipc/shm.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/shm.c 2007-03-01 11:53:25.000000000 -0500 @@ -329,6 +337,9 @@ static int newseg (struct ipc_namespace if (ns->shm_tot + numpages > ns->shm_ctlall) return -ENOSPC; + if (!vx_ipcshm_avail(current->vx_info, numpages)) + return -ENOSPC; + shp = ipc_rcu_alloc(sizeof(*shp)); if (!shp) return -ENOMEM; --- olpc-2.6-master.00/ipc/shm.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/shm.c 2007-03-01 11:53:25.000000000 -0500 @@ -334,6 +345,7 @@ ***** return -ENOMEM; shp->shm_perm.key = key; + shp->shm_perm.xid = vx_current_xid(); shp->shm_perm.mode = (shmflg & S_IRWXUGO); shp->mlock_user = NULL; --- olpc-2.6-master.00/ipc/shm.c 2007-02-28 20:05:29.000000000 -0500 +++ olpc-2.6-master-vs22x.02/ipc/shm.c 2007-03-01 11:53:25.000000000 -0500 @@ -379,6 +391,7 @@ static int newseg (struct ipc_namespace shp->shm_file = file; ns->shm_tot += numpages; + vx_ipcshm_add(current->vx_info, key, numpages); shm_unlock(shp); return shp->id;