You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently received access to the OpenCSW compile farm. The farm provides access to Solaris 9 through 11 on x86 and Sparc hardware. The machines make both GCC and SunCC available.
The cryptest.exe test program experienced a string of SIGBUS crashes. We kind of expected some trouble due to Issue 403. First it was SHA-384 (Issue 689), and then it was Tiger (Issue 690). Once Tiger was cleared VMAC crashed with a SIGBUS. It became obvious these were not one-offs.
We added code at Commit 0c0b68a4a28b to align the buffers in IteratedHashBase::HashMultipleBlocks() which should have avoided the SIGBUS:
if (noReverse)
{
if (IsAligned<HashWordType>(input))
{
// Sparc bus error with non-aligned input.
this->HashEndianCorrectedBlock(input);
}
else
{
std::memcpy(dataBuf, input, blockSize);
this->HashEndianCorrectedBlock(dataBuf);
}
}
else
{
if (IsAligned<HashWordType>(input))
{
// Sparc bus error with non-aligned input.
ByteReverse(dataBuf, input, blockSize);
this->HashEndianCorrectedBlock(dataBuf);
}
else
{
std::memcpy(dataBuf, input, blockSize);
ByteReverse(dataBuf, dataBuf, blockSize);
this->HashEndianCorrectedBlock(dataBuf);
}
}
We were still catching SIGBUSes after the change. Eventually the issue was tracked back to IsAligned<HashWordType>(), which uses GetAlignmentOf(). Notice there is no path for the SunCC compiler.
With SunCC we landed in the UnsignedMin(4U, sizeof(T)) code path. Things worked fine with -xmemalign=4i but failed without it because alignment requirements of word64 is 8 without-xmemalign. Lack of -xmemalign is a good thing and means SunCC will generate a super-fast ldx machine instruction to load a 64-bit word (but it requires a 8-byte aligned load address).
The fix was simple. Add another code path for SunCC. The addition below was tested on the compile farm back to SunCC 5.8 on Solaris 9:
We recently received access to the OpenCSW compile farm. The farm provides access to Solaris 9 through 11 on x86 and Sparc hardware. The machines make both GCC and SunCC available.
The
cryptest.exe
test program experienced a string of SIGBUS crashes. We kind of expected some trouble due to Issue 403. First it was SHA-384 (Issue 689), and then it was Tiger (Issue 690). Once Tiger was cleared VMAC crashed with a SIGBUS. It became obvious these were not one-offs.We added code at Commit 0c0b68a4a28b to align the buffers in
IteratedHashBase::HashMultipleBlocks()
which should have avoided the SIGBUS:We were still catching SIGBUSes after the change. Eventually the issue was tracked back to
IsAligned<HashWordType>()
, which usesGetAlignmentOf()
. Notice there is no path for the SunCC compiler.With SunCC we landed in the
UnsignedMin(4U, sizeof(T))
code path. Things worked fine with-xmemalign=4i
but failed without it because alignment requirements ofword64
is 8 without-xmemalign
. Lack of-xmemalign
is a good thing and means SunCC will generate a super-fastldx
machine instruction to load a 64-bit word (but it requires a 8-byte aligned load address).The fix was simple. Add another code path for SunCC. The addition below was tested on the compile farm back to SunCC 5.8 on Solaris 9:
The text was updated successfully, but these errors were encountered: