--- zzzz-none-000/linux-2.6.28.10/ipc/sem.c 2009-05-02 18:54:43.000000000 +0000 +++ fusiv-7390-686/linux-2.6.28.10/ipc/sem.c 2013-02-01 09:37:10.000000000 +0000 @@ -313,6 +313,7 @@ struct ipc_namespace *ns; struct ipc_ops sem_ops; struct ipc_params sem_params; + int id; ns = current->nsproxy->ipc_ns; @@ -327,7 +328,16 @@ sem_params.flg = semflg; sem_params.u.nsems = nsems; - return ipcget(ns, &sem_ids(ns), &sem_ops, &sem_params); + id = ipcget(ns, &sem_ids(ns), &sem_ops, &sem_params); + +#if 0 + if (id >= 0) + printk(KERN_NOTICE "%s(%d): semget(0x%lx,%d,0%o)=%d\n", + current->comm, current->pid, + key, nsems, semflg, id); +#endif + + return id; } /* @@ -896,6 +906,7 @@ if (semid < 0) return -EINVAL; + version = ipc_parse_version(&cmd); ns = current->nsproxy->ipc_ns; @@ -913,6 +924,9 @@ case GETZCNT: case SETVAL: case SETALL: + if (semid == 0) + printk(KERN_ERR "semctl(: %s(%d): using uninitialized semid (0).\n", + current->comm, current->pid); err = semctl_main(ns,semid,semnum,cmd,version,arg); return err; case IPC_RMID: @@ -1068,6 +1082,10 @@ unsigned long jiffies_left = 0; struct ipc_namespace *ns; + if (semid == 0) + printk(KERN_ERR "sem(timed)op: %s(%d): using uninitialized semid (0).\n", + current->comm, current->pid); + ns = current->nsproxy->ipc_ns; if (nsops < 1 || semid < 0) @@ -1330,6 +1348,10 @@ struct sem * semaphore = &sma->sem_base[i]; if (un->semadj[i]) { semaphore->semval += un->semadj[i]; + printk(KERN_NOTICE "%s(%d): sem-undo(%d) += %ld (semval %d) \n", + tsk->comm, tsk->pid, + semid, + un->semadj[i], semaphore->semval); /* * Range checks of the new semaphore value, * not defined by sus: