mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] SUSv2 msgctl compliance
@ 2002-05-24  5:44 Christopher Yeoh
  2002-05-24 14:45 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Yeoh @ 2002-05-24  5:44 UTC (permalink / raw)
  To: Marcelo Tosatti, Linus Torvalds; +Cc: linux-kernel, trivial


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-24 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-24  5:44 [PATCH] SUSv2 msgctl compliance Christopher Yeoh
2002-05-24 14:45 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®