Hello L4 hackers, we've encountered a problem with an IPC transmission based on DICE stubs generated from the following interface definition: UInt32 process( [in, size_is(bufferALen), max_is(MAX_BUFFER_SIZE)] UInt8* bufferA, [in] UInt32 bufferALen, [in, size_is(bufferBLen), max_is(MAX_BUFFER_SIZE)] UInt8* bufferB , [in] UInt32 bufferBLen, [out, size_is(*bufferCLen), max_is(MAX_BUFFER_SIZE)] UInt8** bufferC, [out] UInt32* bufferCLen); UInt8 is defined as unsigned char, UInt32 is defined as unsigned long, MAX_BUFFER_SIZE is 1500. We are using dice version 3.1.0 with the command line options -fforce-corba-alloc -nostdinc -P-DL4API_l4v2 and the latest OTC snapshot. In this configuration bufferB is not transmitted correctly but is received as corrupt data on the server side (which is an L4Linux application). Is there anything wrong with our interface definition? Any hints appreciated! Michael -- Sirrix AG security technologies - http://www.sirrix.com Michael Scheibel eMail: m.scheibel@sirrix.com Tel +49(234) 610 071-124 Public key on demand. Fingerprint 009B 9963 7B28 4356 CA43 5BFD 17A4 AE0F 6943 4B54 This message may contain confidential and/or privileged information. If you are not the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michael Scheibel wrote on 09.02.2007 11:52 this:
Hello L4 hackers,
we've encountered a problem with an IPC transmission based on DICE stubs generated from the following interface definition:
UInt32 process( [in, size_is(bufferALen), max_is(MAX_BUFFER_SIZE)] UInt8* bufferA, [in] UInt32 bufferALen, [in, size_is(bufferBLen), max_is(MAX_BUFFER_SIZE)] UInt8* bufferB , [in] UInt32 bufferBLen, [out, size_is(*bufferCLen), max_is(MAX_BUFFER_SIZE)] UInt8** bufferC, [out] UInt32* bufferCLen);
UInt8 is defined as unsigned char, UInt32 is defined as unsigned long, MAX_BUFFER_SIZE is 1500.
We are using dice version 3.1.0 with the command line options -fforce-corba-alloc -nostdinc -P-DL4API_l4v2 and the latest OTC snapshot.
In this configuration bufferB is not transmitted correctly but is received as corrupt data on the server side (which is an L4Linux application).
Is there anything wrong with our interface definition? Any hints appreciated! Sorry, for the delay. Confirmed as a Dice bug. I did not get into fixing this yet.
Greets, Ron. - -- Mit freundlichen Gruessen / with regards ra3 @ inf.tu-dresden.de http://os.inf.tu-dresden.de/~ra3/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFF0C+S2sAx3Dtx9+YRAkNVAJ9RrrWrKCAv1UN8sKCW9syOeU5wYwCgwRsl OMOF917RLAgHrOXZ+DT3N2o= =qK2N -----END PGP SIGNATURE-----
Hi, Ronald Aigner wrote on 12.02.2007 10:12 this:
Is there anything wrong with our interface definition? Any hints appreciated! Sorry, for the delay. Confirmed as a Dice bug. I did not get into fixing this yet. please find attached a diff for a work around.
HTH, Ron. -- Mit freundlichen Gruessen / with regards ra3 @ inf.tu-dresden.de http://os.inf.tu-dresden.de/~ra3/ Index: BEMsgBufferType.cpp =================================================================== --- BEMsgBufferType.cpp (.../trunk/dice/src/be/BEMsgBufferType.cpp) (revision 27752) +++ BEMsgBufferType.cpp (.../tags/public/dice/3.1.1/src/be/BEMsgBufferType.cpp) (revision 27752) @@ -569,6 +569,12 @@ __func__, pParameter->m_Declarators.First()->GetName().c_str(), pStruct); + // check out if the parent of the message buffer (a function) is at the + // client or server side. At the server side this message buffer is + // probably global (exceptions to this rule have to be handled when they + // arise). + CBEFunction *pFunc = GetSpecificParent<CBEFunction>(); + bool bGlobal = (pFunc) ? pFunc->IsComponentSide() : true; CBEDeclarator *pDecl = pParameter->m_Declarators.First(); @@ -687,71 +693,57 @@ // // If no stars but array bounds, rely on those and get the hell outa // here - // - // \todo: variable sized arrays should be placed into a byte array and - // be marshalled/unmarshalled with offset variables. - // Because this is not done yet, the size_is size of the array cannot - // be applied if two variable sized arrays are used: the second starts - // at the sender's side right behind the size of the first, but on the - // receiver's side, the max-is size is used for the first array. - // - // check out if the parent of the message buffer (a function) is at the - // client or server side. At the server side this message buffer is - // probably global (exceptions to this rule have to be handled when they - // arise). -// CBEFunction *pFunc = GetSpecificParent<CBEFunction>(); -// bool bGlobal = (pFunc) ? pFunc->IsComponentSide() : true; -// if ((pParameter->m_Attributes.Find(ATTR_SIZE_IS) || -// pParameter->m_Attributes.Find(ATTR_LENGTH_IS)) && -// !pParameter->m_Attributes.Find(ATTR_OUT) && -// !((pDecl->GetStars() == 0) && -// (pDecl->GetArrayDimensionCount() > nEmptyBounds)) && -// !bGlobal) -// { -// CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, -// "CBEMsgBufferType::%s param has unbound array dimensions\n", -// __func__); -// // check for stars that have to be removed -// if (pDecl->GetStars() > 0) -// pDecl->IncStars(-1); -// // add size_is parameter as array bound -// CBEAttribute *pAttr = pParameter->m_Attributes.Find(ATTR_SIZE_IS); -// if (!pAttr) -// pAttr = pParameter->m_Attributes.Find(ATTR_LENGTH_IS); -// CBEExpression *pExpr = pCF->GetNewExpression(); -// if (pAttr->IsOfType(ATTR_CLASS_INT)) -// { -// pExpr->CreateBackEnd(pAttr->GetIntValue()); -// } -// else if (pAttr->IsOfType(ATTR_CLASS_IS)) -// { -// CBEDeclarator *pIsDecl = pAttr->m_Parameters.First(); -// pExpr->CreateBackEnd(pIsDecl->GetName()); -// } -// else -// pExpr->CreateBackEnd(0); -// // look for empty bound and remove it (it will be replaced by new -// // boundary -// if (nEmptyBounds > 0) -// { -// for (iterB = pDecl->m_Bounds.begin(); -// iterB != pDecl->m_Bounds.end(); -// iterB++) -// { -// if ((*iterB)->GetIntValue() == 0) -// { -// pDecl->RemoveArrayBound(*iterB); -// break; -// } -// } -// } -// pDecl->AddArrayBound(pExpr); -// -// // return here -// CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, -// "CBEMsgBufferType::%s array fixed, returns\n", __func__); -// return; -// } + if ((pParameter->m_Attributes.Find(ATTR_SIZE_IS) || + pParameter->m_Attributes.Find(ATTR_LENGTH_IS)) && + !pParameter->m_Attributes.Find(ATTR_OUT) && + !((pDecl->GetStars() == 0) && + (pDecl->GetArrayDimensionCount() > nEmptyBounds)) && + !bGlobal) + { + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s param has unbound array dimensions\n", + __func__); + // check for stars that have to be removed + if (pDecl->GetStars() > 0) + pDecl->IncStars(-1); + // add size_is parameter as array bound + CBEAttribute *pAttr = pParameter->m_Attributes.Find(ATTR_SIZE_IS); + if (!pAttr) + pAttr = pParameter->m_Attributes.Find(ATTR_LENGTH_IS); + CBEExpression *pExpr = pCF->GetNewExpression(); + if (pAttr->IsOfType(ATTR_CLASS_INT)) + { + pExpr->CreateBackEnd(pAttr->GetIntValue()); + } + else if (pAttr->IsOfType(ATTR_CLASS_IS)) + { + CBEDeclarator *pIsDecl = pAttr->m_Parameters.First(); + pExpr->CreateBackEnd(pIsDecl->GetName()); + } + else + pExpr->CreateBackEnd(0); + // look for empty bound and remove it (it will be replaced by new + // boundary + if (nEmptyBounds > 0) + { + for (iterB = pDecl->m_Bounds.begin(); + iterB != pDecl->m_Bounds.end(); + iterB++) + { + if ((*iterB)->GetIntValue() == 0) + { + pDecl->RemoveArrayBound(*iterB); + break; + } + } + } + pDecl->AddArrayBound(pExpr); + + // return here + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s array fixed, returns\n", __func__); + return; + } // handle arrays: if we have a max_is and no array bounds, we add the // max_is as array bound.
Ronald Aigner wrote on 14.02.2007 18:44 this:
please find attached a diff for a work around. Sorry, wrong order. Now, please find attached a patch for a work around.
HTH, Ron. -- Mit freundlichen Gruessen / with regards ra3 @ inf.tu-dresden.de http://os.inf.tu-dresden.de/~ra3/ Index: BEMsgBufferType.cpp =================================================================== --- BEMsgBufferType.cpp (.../tags/public/dice/3.1.1/src/be/BEMsgBufferType.cpp) (revision 27752) +++ BEMsgBufferType.cpp (.../trunk/dice/src/be/BEMsgBufferType.cpp) (revision 27752) @@ -569,12 +569,6 @@ __func__, pParameter->m_Declarators.First()->GetName().c_str(), pStruct); - // check out if the parent of the message buffer (a function) is at the - // client or server side. At the server side this message buffer is - // probably global (exceptions to this rule have to be handled when they - // arise). - CBEFunction *pFunc = GetSpecificParent<CBEFunction>(); - bool bGlobal = (pFunc) ? pFunc->IsComponentSide() : true; CBEDeclarator *pDecl = pParameter->m_Declarators.First(); @@ -693,57 +687,71 @@ // // If no stars but array bounds, rely on those and get the hell outa // here - if ((pParameter->m_Attributes.Find(ATTR_SIZE_IS) || - pParameter->m_Attributes.Find(ATTR_LENGTH_IS)) && - !pParameter->m_Attributes.Find(ATTR_OUT) && - !((pDecl->GetStars() == 0) && - (pDecl->GetArrayDimensionCount() > nEmptyBounds)) && - !bGlobal) - { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "CBEMsgBufferType::%s param has unbound array dimensions\n", - __func__); - // check for stars that have to be removed - if (pDecl->GetStars() > 0) - pDecl->IncStars(-1); - // add size_is parameter as array bound - CBEAttribute *pAttr = pParameter->m_Attributes.Find(ATTR_SIZE_IS); - if (!pAttr) - pAttr = pParameter->m_Attributes.Find(ATTR_LENGTH_IS); - CBEExpression *pExpr = pCF->GetNewExpression(); - if (pAttr->IsOfType(ATTR_CLASS_INT)) - { - pExpr->CreateBackEnd(pAttr->GetIntValue()); - } - else if (pAttr->IsOfType(ATTR_CLASS_IS)) - { - CBEDeclarator *pIsDecl = pAttr->m_Parameters.First(); - pExpr->CreateBackEnd(pIsDecl->GetName()); - } - else - pExpr->CreateBackEnd(0); - // look for empty bound and remove it (it will be replaced by new - // boundary - if (nEmptyBounds > 0) - { - for (iterB = pDecl->m_Bounds.begin(); - iterB != pDecl->m_Bounds.end(); - iterB++) - { - if ((*iterB)->GetIntValue() == 0) - { - pDecl->RemoveArrayBound(*iterB); - break; - } - } - } - pDecl->AddArrayBound(pExpr); - - // return here - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, - "CBEMsgBufferType::%s array fixed, returns\n", __func__); - return; - } + // + // \todo: variable sized arrays should be placed into a byte array and + // be marshalled/unmarshalled with offset variables. + // Because this is not done yet, the size_is size of the array cannot + // be applied if two variable sized arrays are used: the second starts + // at the sender's side right behind the size of the first, but on the + // receiver's side, the max-is size is used for the first array. + // + // check out if the parent of the message buffer (a function) is at the + // client or server side. At the server side this message buffer is + // probably global (exceptions to this rule have to be handled when they + // arise). +// CBEFunction *pFunc = GetSpecificParent<CBEFunction>(); +// bool bGlobal = (pFunc) ? pFunc->IsComponentSide() : true; +// if ((pParameter->m_Attributes.Find(ATTR_SIZE_IS) || +// pParameter->m_Attributes.Find(ATTR_LENGTH_IS)) && +// !pParameter->m_Attributes.Find(ATTR_OUT) && +// !((pDecl->GetStars() == 0) && +// (pDecl->GetArrayDimensionCount() > nEmptyBounds)) && +// !bGlobal) +// { +// CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, +// "CBEMsgBufferType::%s param has unbound array dimensions\n", +// __func__); +// // check for stars that have to be removed +// if (pDecl->GetStars() > 0) +// pDecl->IncStars(-1); +// // add size_is parameter as array bound +// CBEAttribute *pAttr = pParameter->m_Attributes.Find(ATTR_SIZE_IS); +// if (!pAttr) +// pAttr = pParameter->m_Attributes.Find(ATTR_LENGTH_IS); +// CBEExpression *pExpr = pCF->GetNewExpression(); +// if (pAttr->IsOfType(ATTR_CLASS_INT)) +// { +// pExpr->CreateBackEnd(pAttr->GetIntValue()); +// } +// else if (pAttr->IsOfType(ATTR_CLASS_IS)) +// { +// CBEDeclarator *pIsDecl = pAttr->m_Parameters.First(); +// pExpr->CreateBackEnd(pIsDecl->GetName()); +// } +// else +// pExpr->CreateBackEnd(0); +// // look for empty bound and remove it (it will be replaced by new +// // boundary +// if (nEmptyBounds > 0) +// { +// for (iterB = pDecl->m_Bounds.begin(); +// iterB != pDecl->m_Bounds.end(); +// iterB++) +// { +// if ((*iterB)->GetIntValue() == 0) +// { +// pDecl->RemoveArrayBound(*iterB); +// break; +// } +// } +// } +// pDecl->AddArrayBound(pExpr); +// +// // return here +// CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, +// "CBEMsgBufferType::%s array fixed, returns\n", __func__); +// return; +// } // handle arrays: if we have a max_is and no array bounds, we add the // max_is as array bound.
Am Mittwoch 14 Februar 2007 19:34 schrieb Ronald Aigner:
Ronald Aigner wrote on 14.02.2007 18:44 this:
please find attached a diff for a work around.
Sorry, wrong order. Now, please find attached a patch for a work around.
HTH, Ron.
Hi Ron, the patch seems to solve the problem, even for dice 3.1.0. Thank you! Michael -- Sirrix AG security technologies - http://www.sirrix.com Michael Scheibel eMail: m.scheibel@sirrix.com Tel +49(234) 610 071-124 Public key on demand. Fingerprint 009B 9963 7B28 4356 CA43 5BFD 17A4 AE0F 6943 4B54 Vorstand: Ammar Alkassar (Vors.), Ahmad-Reza Sadeghi, Christian Stüble Vorsitzender des Aufsichtsrates: Prof. Dr. Kai Rannenberg Sitz der Gesellschaft: Homburg/Saar, HRB 3857 Amtsgericht Saarbrücken This message may contain confidential and/or privileged information. If you are not the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message.
participants (2)
-
Michael Scheibel -
Ronald Aigner