Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Sep 2000 23:53:45 +0200 (CEST)
From:      saper@SYSTEM.PL
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        peter@freebsd.org
Subject:   kern/21085: [patch] SYSV IPC msg queues creation failed with ENOSPC
Message-ID:  <200009062153.e86Lrj102738@barbera.system.pl>

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

>Number:         21085
>Category:       kern
>Synopsis:       [patch] SYSV IPC msg queues creation failed with ENOSPC
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 06 15:00:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Marcin Cieslak
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
SYSTEM Internet Provider - http://www.system.pl/
>Environment:

Any -current system after 2000/05/01
Any RELENG_4 system after 2000/08/04

/* $FreeBSD: src/sys/kern/sysv_msg.c,v 1.23.2.1 2000/08/04 22:31:08 peter Exp $ */
 ipcs -Q
msginfo:
        msgmax:  16384  (max characters in a message)
        msgmni:     40  (# of message queues)
        msgmnb:   2048  (max characters in a message queue)
        msgtql:     40  (max # of messages in system)
        msgssz:      8  (size of a message segment)
        msgseg:   2048  (# of message segments in system)

>Description:

The msgget(3) began to fail strangely with errno = ENOSPC
even at the system boot. The problem is with msqids struct
initialization - msg_perm.mode field was tested at sys/kern/sysv_msg.c:442,
but has not been previously initialized properly
at sys/kern/sysv_msg.c:190. 

>How-To-Repeat:

Try to run the following program, however
we were unable to reproduce the bug on some other machines.
The program failed with ENOSPC even with empty msg queue table.

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>


int
main()
{ 
        int msgq;
        msgq = msgget(IPC_PRIVATE,IPC_CREAT);
        printf("Result: %d\n", msgq);
        if (msgq == -1)
                perror("msgget");
        return 0;
}



>Fix:

Beware, all other sysv_* files should be inspected
closely, because malloc() for the structures
has been introduced on May, 1st. 2000.

Index: sysv_msg.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/sysv_msg.c,v
retrieving revision 1.23.2.1
diff -u -r1.23.2.1 sysv_msg.c
--- sysv_msg.c	2000/08/04 22:31:08	1.23.2.1
+++ sysv_msg.c	2000/09/06 21:29:54
@@ -188,6 +188,7 @@
 	for (i = 0; i < msginfo.msgmni; i++) {
 		msqids[i].msg_qbytes = 0;	/* implies entry is available */
 		msqids[i].msg_perm.seq = 0;	/* reset to a known value */
+		msqids[i].msg_perm.mode = 0;	/* this should be reset, too */
 	}
 }
 SYSINIT(sysv_msg, SI_SUB_SYSV_MSG, SI_ORDER_FIRST, msginit, NULL)

>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?200009062153.e86Lrj102738>