lkml.org 
[lkml]   [2000]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectProblem with msgsnd
msgsnd seems to be corrupting memory around the msgbuf pointer.

for example I have the following code:

pMsgBuf = malloc(iPacketLen + 4 + 8);
bzero(pMsgBuf, iPacketLen + 4 + 8);
pMsgBuf += 4; /* Build a guard band */

printf("PMQ:pMsgBuf: %p\n",pMsgBuf);
printf("PMQ:-4: %p\n", *(pMsgBuf-4));

rc = msgsnd(iMsgQueueID, pMsgBuf, iPacketLen, 0);

printf("AMQ:pMsgBuf: %p\n",pMsgBuf);
printf("AMQ:-4: %p\n", *(pMsgBuf-4));

results in the following output:

PMQ:pMsgBuf: 0x8067424
PMQ:-4: (nil)
AMQ:pMsgBuf: 0x8067424
AMQ:-4: 0x3

clearly, AMQ:-4 should print (nil).

Any ideas as to what could be going wrong?

I'm am running a stock Redhat 6.1 system, kernel 2.2.14 I believe.

This is also causing a segmentation fault.

Marc
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.031 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site