Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Dec 2002 14:39:06 +0300
From:      "Vladimir B.Grebenschikov" <vova@sw.r>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/46122: msgget() can return negative value after extensive use
Message-ID:  <E18LMFe-0001eC-00@vbook.express.ru>

next in thread | raw e-mail | index | archive | help

>Number:         46122
>Category:       kern
>Synopsis:       msgget() can return negative value after extensive use
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 09 03:40:04 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Vladimir B. Grebenschikov
>Release:        FreeBSD 5.0-RC i386
>Organization:
SWsoft
>Environment:
System: FreeBSD vbook.express.ru 5.0-RC FreeBSD 5.0-RC #23: Sun Dec 8 14:54:44 MSK 2002 root@vbook.express.ru:/usr/local/src/sys/i386/compile/VBOOK i386

This bug also appears in 4-STABLE branch

>Description:

msgget() function according to manpage should return positive identifier,
but after some hours of extencive use kernel counter overflowed and negative
number is returned.

>How-To-Repeat:

I have use perl test suite.
perl lib/IPC/SysV.t

>Fix:

Below kernel patch to fix problem

Index: kern/sysv_msg.c
===================================================================
RCS file: /ext/vcvs/src/sys/kern/sysv_msg.c,v
retrieving revision 1.23.2.3.10000.7
diff -u -r1.23.2.3.10000.7 sysv_msg.c
--- kern/sysv_msg.c	2 Dec 2002 16:44:36 -0000	1.23.2.3.10000.7
+++ kern/sysv_msg.c	9 Dec 2002 10:24:45 -0000
@@ -440,7 +440,7 @@
 		msqptr->msg_perm.gid = cred->cr_gid;
 		msqptr->msg_perm.mode = (msgflg & 0777);
 		/* Make sure that the returned msqid is unique */
-		msqptr->msg_perm.seq++;
+		msqptr->msg_perm.seq = (msqptr->msg_perm.seq+1) & 0x7fff;
 		msqptr->msg_first = NULL;
 		msqptr->msg_last = NULL;
 		msqptr->msg_cbytes = 0;


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E18LMFe-0001eC-00>