From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,2e645b3d49aaa694 X-Google-Attributes: gidfee84,public From: Jeff Sullivan Subject: Re: Segmentation fault exceptions under DU4.0 (msgrcv?) Date: 1998/02/16 Message-ID: <34E866CE.48BD60D9@zk3.dec.com>#1/1 X-Deja-AN: 325583249 Content-Transfer-Encoding: 7bit References: <6c20te$m08@romeo.logica.co.uk> Mime-Version: 1.0 To: turnergw-at-logica-dot-com@zk3.dec.com Content-Type: text/plain; charset=us-ascii Organization: Digital Equipment Corporation Newsgroups: comp.unix.osf.osf1 Are you using msgrcv() ? We've run into that problem a few times recently. Take a look at the response below for more info. Potential data corruption in DIGITAL UNIX V4.0x with msgrcv() A kernel change from V3.2 to V4.0 results in an application error causing data corruption. A signature of this problem is that the 8 bytes immediately following the buffer are overwritten with the size passed in to msgrcv() The standard interface for msgrcv could be considered unintuitive, particularly the specification of the msgsz parameter. The msgp parameter is the address of a buffer into which the message type and message text are written. The standard specifies that this buffer is a structure consisting of a long int, into which the message type is written followed by application specific data. For example, the following structure could be used: struct mymsg { long int mtype; /* for the message type */ char mtext[123]; /* for the message data */ } The msgsz parameter is the size of the data following the initial long int! For instance, in the example above, it would be correct to pass the size of mtext. It is not correct to pass sizeof(struct mymsg). In DIGITAL UNIX V4.0, a change was made which results in writing the last longword of the buffer, as specified by the address and length passed in. If the application incorrectly passes in the size of the entire buffer, including the leading long, then this will result in the long immediately following the buffer being corrupted. A signature of this problem is that the corrupted cell will contain the value passed in the msgsz parameter to the msgrcv service. Let us know if this helps. -Jeff -- Jeff Sullivan | Digital Equipment Corp | E-mail: jps@zk3.dec.com DEC C and C++ | Nashua, NH ZK3-2/2X09 | sullivan@decc.enet.dec.com