[openssl-dev] [openssl.org #4667] Issue with OpenSSL v1.1.0 on AIX with XLC and GCC and -O

REIX, Tony via RT rt at openssl.org
Thu Sep 1 10:08:47 UTC 2016


Hi Richard,

Here are more information.

I'm using two AIX 6.1 machines.
I built openssl 1.0.1* and 1.0.2* on first machine, compiled with GCC & -O .
I moved to second machine for 1.1.0 .

I have rebuilt/tested 1.0.2h , still with GCC & -O (same .spec file), on the second machine and I got the same results than on machine 1 (which has different AIX 6.1 details and different XLC 12.1.0 sub-versions than the other machine. See below).


On machine 2, once I had built valid RPMs of openssl 1.1.0, I have installed them on the machine so that I'm sure that tests are done with the current version (sometimes, some packages make use of installed stuff, like .h or .a files).
However, I've made local experiments and I've checked that only/simply locally compiling ppccap.o with -O and then with -O0 (and rebuilding the libcrypto.so and libcrypto.a that are used when testing by end) DOES trigger the test error or not.


First, I've noticed some changes between 1.0.2h and 1.1.0 .
- One notable change deals with the AIX targets for Configure:
   - 1.0.2h : aix-gcc  aix-xlc_r  aix3-cc  aix64-gcc  aix64-xlc_r
   - 1.1.0  : aix-cc   aix-gcc             aix64-cc   aix64-gcc
  So, for 1.0.2h and XLC, I used aix-xlc_r  & aix64-xlc_r .
  And, for 1.1.0 and XLC, I'm using aix-cc & aix64-cc . I have no idea about the impact.
- Another change deals with the tests, which have a different output.


- Machine 1 (hardy1)

# oslevel -s
6100-07-10-1415
# xlc -qversion
IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
Version: 12.01.0000.0016
# gcc --version
gcc (GCC) 4.8.4


- Machine 2 (castor1)
# oslevel -s
6100-09-03-1415
# xlc -qversion
IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
Version: 12.01.0000.0014
# gcc --version
gcc (GCC) 6.2.0



Results:


In short:
 - no issue with v1.0.2h on both machines
 - issue appears with:
      - XLC -O but only for 64bits
      - GCC -O for both 64bits and 32bits
 - issue disappears when building ppccap.c with -O0 .

So, I think that the probability that both XLC and GCC have an issue when optimizing ppccap.c is very low.
So, I guess that ppccap.c has something special.

Further experimentations could be:
- still on machine2 :
  - use XLC v13 instead of v12
  - use GCC v4.8.4 instead of v6.2.0 .
- maybe redo all on machine1, if needed.


Details:

1) openssl v1.0.2h with XLC and -O for all C source code.
Machine 1 & Machine 2

- 64bit:
/usr/vac/bin/xlc_r -I. -I.. -I../include  -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -qthreaded -D_THREAD_SAFE -DDSO_DLFCN -DHAVE_DLFCN_H -DSSL_ALLOW_ADH -q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DVPAES_ASM   -c -o ppccap.o ppccap.c

# grep SUCCESSFUL $SPECS/openssl-1.0.2h-2.spec.res4.TESTS-64
ALL TESTS SUCCESSFUL.
ALL OCSP TESTS SUCCESSFUL

# cd 64bit/test
# ../util/shlib_wrap.sh ./evp_test evptests.txt
...
# echo $?
0

- 32bit:
/usr/vac/bin/xlc_r -I. -I.. -I../include  -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -qthreaded -D_THREAD_SAFE -DDSO_DLFCN -DHAVE_DLFCN_H -DSSL_ALLOW_ADH -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DVPAES_ASM   -c -o ppccap.o ppccap.c

# grep SUCCESSFUL $SPECS/openssl-1.0.2h-2.spec.res4.TESTS-32
ALL TESTS SUCCESSFUL.
ALL OCSP TESTS SUCCESSFUL

# cd 32bit/test
# ../util/shlib_wrap.sh ./evp_test evptests.txt
...
# echo $?
0


2) openssl v1.1.0 with XLC and -O for all C source code.
Machine 2

- 64bit:

xlc_r -q64  -I. -Icrypto/include -Iinclude -DZLIB -DZLIB_SHARED -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_DYNAMIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DVPAES_ASM -DPOLY1305_ASM -DSSL_ALLOW_ADH -DOPENSSLDIR="\"/var/ssl/64\"" -DENGINESDIR="\"/opt/freeware/lib/engines-1.1\"" -q64 -DB_ENDIAN -qmaxmem=16384 -qro -qroconst -O -qthreaded -D_THREAD_SAFE   -c -o crypto/ppccap.o crypto/ppccap.c
"crypto/ppccap.c", line 123.17: 1506-068 (W) Operation between types "void*" and "void(*)(void*,const unsigned char*,unsigned long,unsigned int)" is not allowed.
"crypto/ppccap.c", line 124.17: 1506-068 (W) Operation between types "void*" and "void(*)(void*,unsigned char*,const unsigned int*)" is not allowed.
"crypto/ppccap.c", line 127.17: 1506-068 (W) Operation between types "void*" and "void(*)(void*,const unsigned char*,unsigned long,unsigned int)" is not allowed.
"crypto/ppccap.c", line 128.17: 1506-068 (W) Operation between types "void*" and "void(*)(void*,unsigned char*,const unsigned int*)" is not allowed.

#   Failed test 'running evp_test evptests.txt'
#   at ../test/recipes/30-test_evp.t line 18.
# Looks like you failed 1 test of 1.
../test/recipes/30-test_evp.t ..............
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests

- 32bit:
xlc_r -q32  -I. -Icrypto/include -Iinclude -DZLIB -DZLIB_SHARED -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_DYNAMIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DVPAES_ASM -DPOLY1305_ASM -DSSL_ALLOW_ADH -DOPENSSLDIR="\"/var/ssl\""
-DENGINESDIR="\"/opt/freeware/lib/engines-1.1\"" -q32 -DB_ENDIAN -qmaxmem=16384 -qro -qroconst -O -qthreaded -D_THREAD_SAFE   -c -o crypto/ppccap.o crypto/ppccap.c
"crypto/ppccap.c", line 123.17: 1506-068 (W) Operation between types "void*" and "void(*)(void*,const unsigned char*,unsigned long,unsigned int)" is not allowed.
"crypto/ppccap.c", line 124.17: 1506-068 (W) Operation between types "void*" and "void(*)(void*,unsigned char*,const unsigned int*)" is not allowed.
"crypto/ppccap.c", line 127.17: 1506-068 (W) Operation between types "void*" and "void(*)(void*,const unsigned char*,unsigned long,unsigned int)" is not allowed.
"crypto/ppccap.c", line 128.17: 1506-068 (W) Operation between types "void*" and "void(*)(void*,unsigned char*,const unsigned int*)" is not allowed.

../test/recipes/30-test_evp.t .............. ok


3) openssl v1.1.0 with GCC and -O for all C source code.
Machine 2

- 64bit:
gcc -maix64  -I. -Icrypto/include -Iinclude -DZLIB -DZLIB_SHARED -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_DYNAMIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DVPAES_ASM -DPOLY1305_ASM -DSSL_ALLOW_ADH -DOPENSSLDIR="\"/var/ssl/64\"" -DENGINESDIR="\"/opt/freeware/lib/engines-1.1\"" -maix64 -DB_ENDIAN -O -pthread   -MMD -MF crypto/ppccap.d.tmp -MT crypto/ppccap.o -c -o crypto/ppccap.o crypto/ppccap.c

#   Failed test 'running evp_test evptests.txt'
#   at ../test/recipes/30-test_evp.t line 18.
# Looks like you failed 1 test of 1.
../test/recipes/30-test_evp.t ..............
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests

- 32bit:
gcc -maix32  -I. -Icrypto/include -Iinclude -DZLIB -DZLIB_SHARED -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_DYNAMIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DVPAES_ASM -DPOLY1305_ASM -DSSL_ALLOW_ADH -DOPENSSLDIR="\"/var/ssl\""
-DENGINESDIR="\"/opt/freeware/lib/engines-1.1\""               -DB_ENDIAN -O -pthread   -MMD -MF crypto/ppccap.d.tmp -MT crypto/ppccap.o -c -o crypto/ppccap.o crypto/ppccap.c

#   Failed test 'running evp_test evptests.txt'
#   at ../test/recipes/30-test_evp.t line 18.
# Looks like you failed 1 test of 1.
../test/recipes/30-test_evp.t ..............
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests


Regards,

Tony

Le 31/08/2016 18:46, Richard Levitte via RT a écrit :

Curious. The diverse flags for the aix config targets' information in 1.1.0 are
exact copies from the 1.0.x series...

The best way you can help out here is to show us the build command lines you
got for building crypto/ppccap.o in both 1.1.0 and 1.0.2, so we can see what
actually differs.

Cheers,
Richard

On Wed Aug 31 16:06:30 2016, tony.reix at atos.net<mailto:tony.reix at atos.net> wrote:


Hi,

I do ports of OpenSSL on AIX 6.1 for one year.
I had no issue with 1.0.1* and 1.0.2* versions, compiled with XLC.
With version 1.1.0, I am encountering an issue with -O, both with XLC
and GCC .

30-test_evp.t fails because using -O when compiling crypto/ppccap.c
generates something wrong.
Compiling only crypto/ppccap.c with -O0 does fix the issue.
It is the same with XLC.

I have put in place a simple work-around: use -O0 for crypto/ppccap.c
.

However, do you have an idea about: why crypto/ppccap.c seems
sensitive to optimization ?

Thanks/Regards,

Tony Reix
http://www.bullfreeware.com








--
Richard Levitte
levitte at openssl.org<mailto:levitte at openssl.org>




-- 
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4667
Please log in as guest with password guest if prompted



More information about the openssl-dev mailing list