openssl: Current master fails test-bioprint

MacOS 10.15.5, Xcode-11.5. Current master.

. . . . .
Test Summary Report
-------------------
04-test_bioprint.t               (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=198, Tests=2004, 516 wallclock secs ( 6.82 usr  1.00 sys + 374.49 cusr 90.13 csys = 472.44 CPU)
Result: FAIL

The culprit is 082c041b4233b17 (under-reviewed?).

$ perl configdata.pm --dump

Command line (with current working directory = .):

    /opt/local/bin/perl5.26 ./Configure darwin64-x86_64-cc --prefix=/Users/uri/openssl-3 --debug --openssldir=/Users/uri/openssl-3/etc --with-rand-seed=rdcpu,os enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-weak-ssl-ciphers zlib-dynamic enable-ssl-trace enable-trace threads enable-buildtest-c++

Perl information:

    /opt/local/bin/perl5.26
    5.26.3 for darwin-thread-multi-2level

Enabled features:

    aria
    asm
    async
    autoalginit
    autoerrinit
    autoload-config
    bf
    blake2
    buildtest-c++
    camellia
    capieng
    cast
    chacha
    cmac
    cmp
    cms
    comp
    ct
    deprecated
    des
    dgram
    dh
    dsa
    dso
    dtls
    dynamic-engine
    ec
    ec2m
    ecdh
    ecdsa
    ec_nistp_64_gcc_128
    engine
    err
    filenames
    fips
    gost
    idea
    legacy
    makedepend
    md2
    md4
    mdc2
    module
    multiblock
    nextprotoneg
    pinshared
    ocb
    ocsp
    padlockeng
    pic
    poly1305
    posix-io
    psk
    rc2
    rc4
    rc5
    rdrand
    rfc3779
    rmd160
    scrypt
    secure-memory
    seed
    shared
    siphash
    siv
    sm2
    sm3
    sm4
    sock
    srp
    srtp
    sse2
    ssl
    ssl-trace
    static-engine
    stdio
    tests
    threads
    tls
    trace
    ts
    ui-console
    whirlpool
    weak-ssl-ciphers
    zlib
    zlib-dynamic
    tls1
    tls1-method
    tls1_1
    tls1_1-method
    tls1_2
    tls1_2-method
    tls1_3
    dtls1
    dtls1-method
    dtls1_2
    dtls1_2-method

Disabled features:

    afalgeng            [not-linux]      OPENSSL_NO_AFALGENG
    asan                [default]        OPENSSL_NO_ASAN
    crypto-mdebug       [default]        OPENSSL_NO_CRYPTO_MDEBUG
    devcryptoeng        [default]        OPENSSL_NO_DEVCRYPTOENG
    egd                 [default]        OPENSSL_NO_EGD
    external-tests      [default]        OPENSSL_NO_EXTERNAL_TESTS
    fuzz-libfuzzer      [default]        OPENSSL_NO_FUZZ_LIBFUZZER
    fuzz-afl            [default]        OPENSSL_NO_FUZZ_AFL
    ktls                [default]        OPENSSL_NO_KTLS
    msan                [default]        OPENSSL_NO_MSAN
    sctp                [default]        OPENSSL_NO_SCTP
    ubsan               [default]        OPENSSL_NO_UBSAN
    unit-test           [default]        OPENSSL_NO_UNIT_TEST
    uplink              [no uplink_arch] OPENSSL_NO_UPLINK
    ssl3                [default]        OPENSSL_NO_SSL3
    ssl3-method         [default]        OPENSSL_NO_SSL3_METHOD

Config target attributes:

    AR => "ar",
    ARFLAGS => "r",
    CC => "cc",
    CFLAGS => "-g -O0 -Wall",
    HASHBANGPERL => "/usr/bin/env perl",
    RANLIB => "ranlib -c",
    RC => "windres",
    asm_arch => "x86_64",
    bn_ops => "SIXTY_FOUR_BIT_LONG",
    build_file => "Makefile",
    build_scheme => [ "unified", "unix" ],
    cflags => "-arch x86_64",
    cppflags => "-D_REENTRANT",
    defines => [ "OPENSSL_BUILDING_OPENSSL", "ZLIB", "ZLIB_SHARED" ],
    disable => [  ],
    dso_scheme => "dlfcn",
    enable => [  ],
    includes => [  ],
    lflags => "-Wl,-search_paths_first",
    lib_cflags => "",
    lib_cppflags => "-DL_ENDIAN",
    lib_defines => [  ],
    module_cflags => "-fPIC",
    module_cxxflags => undef,
    module_ldflags => "-bundle",
    perl_platform => "Unix",
    perlasm_scheme => "macosx",
    shared_cflag => "-fPIC",
    shared_defines => [  ],
    shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
    shared_ldflag => "-dynamiclib -current_version \$(SHLIB_VERSION_NUMBER) -compatibility_version \$(SHLIB_VERSION_NUMBER)",
    shared_rcflag => "",
    shared_sonameflag => "-install_name \$(INSTALLTOP)/\$(LIBDIR)/",
    shared_target => "darwin-shared",
    sys_id => "MACOSX",
    thread_defines => [  ],
    thread_scheme => "pthreads",
    unistd => "<unistd.h>",

Recorded environment:

    AR = 
    ARFLAGS = 
    AS = 
    ASFLAGS = 
    BUILDFILE = 
    CC = clang
    CFLAGS = -march=native -Os -Ofast -std=gnu17 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -g
    CPP = 
    CPPDEFINES = 
    CPPFLAGS = -I/opt/local/include
    CPPINCLUDES = 
    CROSS_COMPILE = 
    CXX = clang++
    CXXFLAGS = -march=native -Os -Ofast -std=gnu++17 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
    HASHBANGPERL = 
    LD = 
    LDFLAGS = -L/opt/local/lib
    LDLIBS = 
    MT = 
    MTFLAGS = 
    OPENSSL_LOCAL_CONFIG_DIR = 
    PERL = 
    RANLIB = 
    RC = 
    RCFLAGS = 
    RM = 
    WINDRES = 
    __CNF_CFLAGS = 
    __CNF_CPPDEFINES = 
    __CNF_CPPFLAGS = 
    __CNF_CPPINCLUDES = 
    __CNF_CXXFLAGS = 
    __CNF_LDFLAGS = 
    __CNF_LDLIBS = 

Makevars:

    AR              = ar
    ARFLAGS         = r
    CC              = clang
    CFLAGS          = -march=native -Os -Ofast -std=gnu17 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -g
    CPPDEFINES      = 
    CPPFLAGS        = -I/opt/local/include
    CPPINCLUDES     = 
    CXX             = clang++
    CXXFLAGS        = -march=native -Os -Ofast -std=gnu++17 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
    HASHBANGPERL    = /usr/bin/env perl
    LDFLAGS         = -L/opt/local/lib
    LDLIBS          = 
    PERL            = /opt/local/bin/perl5.26
    RANLIB          = ranlib -c
    RC              = windres
    RCFLAGS         = 

NOTE: These variables only represent the configuration view.  The build file
template may have processed these variables further, please have a look at the
build file for more exact data:
    Makefile

build file:

    Makefile

build file templates:

    Configurations/common0.tmpl
    Configurations/unix-Makefile.tmpl
    Configurations/common.tmpl
$

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (19 by maintainers)

Commits related to this issue

Most upvoted comments

@mouse07410 The unsafe optimization here is that x is read and written back unmodified at the end of the loop. even if the loop does not change the value. The original code does not write back the value, that can make a difference when another thread has modified the value. With -O3 the write back is conditional.

we’re targeting C89/C90

You sure that’s the right target for OpenSSL-3.0 in year 2020? Really?

Visual C++ does not support C99, nor does Microsoft ever intend to support something more recent than C89/C90. So unless we drop suport for Visual C++, we’re stuck at C89/C90.

FWIW, my compiler is set to -std=gnu17.

That doesn’t matter. We do use more recent features of the languages on platforms that support it.

clang and gcc should only do that with -ffast-math

Are you saying that one can no longer build OpenSSL with full optimization? How about just reverting this “fix” https://github.com/openssl/openssl/commit/082c041b4233b17b80129d4ac6b33a28014442b0, instead of fooling around with Undefined Behavior?

Division by 0 is undefined by default, but there is an optional IEEE 754 / IEC 559 support that turns it into defined behaviour for floating point division. I understand that gcc supports it (on some platforms) but clang doesn’t. The patch we provided that uses strtod() instead avoids the undefined behaviour. If you apply the patch to that commit, it doesn’t introduce any undefined behaviour.

Things like -Ofast, -ffast-math and some other options disable standard compliant behaviour. Among other things, it makes gcc and clang assume that NaN and INF will never happen. NaN is part of the C standard even when the IEEE 754 / IEC 559 support is not available.

Since we now use NaN, we have those options:

  • You can no longer disable standard compliant behaviour
  • Try to use the C99 macro. It works for me without needing -lm and with -ffast-math.
  • Find some ugly workaround that looks at the bit patterns, which will then break on platforms that don’t have IEEE 754 floating point.
  • Don’t do anything with NaN, ignore that they exist, and possibly have a buffer overflow instead.