[PATCH] SUSv2 msgctl compliance

From: Christopher Yeoh (cyeoh@samba.org)
Date: Fri May 24 2002 - 00:44:58 EST


For msgctl SUSv2 states:

"IPC_SET can only be executed by a process with appropriate privileges
or that has an effective user ID equal to the value of msg_perm.cuid
or msg_perm.uid in the msqid_ds data structure associated with
msqid. Only a process with appropriate privileges can raise the value
of msg_qbytes."

The current linux behaviour is to allow for the value of msg_qbytes to
be raised even if the process is not privileged. The following
patch (against 2.4.19pre8) fixes this problem:

--- ipc/msg.c.orig Fri May 24 14:51:12 2002
+++ ipc/msg.c Fri May 24 14:58:36 2002
@@ -539,7 +539,8 @@
         switch (cmd) {
         case IPC_SET:
         {
- if (setbuf.qbytes > msg_ctlmnb && !capable(CAP_SYS_RESOURCE))
+ if (setbuf.qbytes > min(msg_ctlmnb, msq->q_qbytes) &&
+ !capable(CAP_SYS_RESOURCE))
                         goto out_unlock_up;
                 msq->q_qbytes = setbuf.qbytes;
 
Chris

-- 
cyeoh@au.ibm.com
IBM OzLabs Linux Development Group
Canberra, Australia
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri May 31 2002 - 22:00:12 EST