Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Jeff Sullivan <jps@zk3.dec.com>
To: turnergw-at-logica-dot-com@zk3.dec.com
Subject: Re: Segmentation fault exceptions under DU4.0 (msgrcv?)
Date: 1998/02/16	[thread overview]
Message-ID: <34E866CE.48BD60D9@zk3.dec.com> (raw)
In-Reply-To: 6c20te$m08@romeo.logica.co.uk


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



  reply	other threads:[~1998-02-16  5:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-13  5:00 Segmentation fault exceptions under DU4.0 turnergw-at-logica-dot-com
1998-02-16  5:00 ` Jeff Sullivan [this message]
1998-02-17  5:00 ` Jeff Sullivan
read-only archive

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