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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to