[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#633458: gcc-4.6 miscompiles libgcrypt11 on armel



On 07/12/2011 07:56 PM, Andreas Metzler wrote:
> On 2011-07-10 Andreas Metzler <ametzler@downhill.at.eu.org> wrote:
>> On 2011-07-10 Andreas Metzler <ametzler@downhill.at.eu.org> wrote:
>>> On 2011-07-10 Andreas Metzler <ametzler@downhill.at.eu.org> wrote:
>>>> Package: gcc-4.6
>>>> Version: 4.6.1-1
>>>> Severity: normal
>>>> Blocks: 633373
> 
>>>> gcc-4.6 seems to miscompile libgcrypt11 on armel, causing total
>>>> failure of gnutls26.
> 
>>>> -------------------------------
>>>> (sid)ametzler@abel:~/GNUTLS$ ~/GNUTLS/2.10.5-2/usr/bin/gnutls-cli db.debian.org Resolving 'db.debian.org'...
>>>> Connecting to '82.195.75.106:443'...
>>>> *** Fatal error: Decryption has failed.
>>>> *** Handshake has failed
>>>> GnuTLS error: Decryption has failed.
>>>> -------------------------------
>>> [...]
> 
>>> Building with -fno-strict-aliasing does not help.
>> [...]
> 
>> The culprit is cipher/rijndael.c. If I build this file with
>> gcc-4.5 the bug goes away.
> 
> Hello,
> 
> I do not know how to go on now.

could you recheck with 4.6.1-3 and gcc-snapshot?
is this exposed on armhf as well (CC'ing Markos)?

> What I tried was splitting rijndael.c into multiple separate files.
> However this made the error go away.
> 
> It seems that the significant change I made when spliting was
> dropping the static qualifier on the function declarations.

maybe try not to inline, or turn off an optimization for this specific
function(s).  Then the assembler output of a working and a non-working function
would help.

__attribute__((noinline))
__attribute__((optimize("O0")))
__attribute__((optimize("no-inline")))
__attribute__((optimize("no-strict-aliasing")))

see
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Function-Attributes.html#Function-Attributes

> 
> The minimal change I found to make my testcase (gnutls-cli
> db.debian.org) go away was dropping the static qualifier from these
> two functions:
> 
> ------------------------
> /* Decrypt one block.  A and B need to be aligned on a 4 byte boundary
>    and the decryption must have been prepared.  A and B may be the
>    same. */
> static void
> do_decrypt_aligned (RIJNDAEL_context *ctx, 
>                     unsigned char *b, const unsigned char *a)
> 
> 
> /* Decrypt one block.  AX and BX may be the same. */
> static void
> do_decrypt (RIJNDAEL_context *ctx, byte *bx, const byte *ax)
> ------------------------

the binary in the archive seems to work. gcc-4.6.0-13 was used for the build.



Reply to: