Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openssl-3.2.0-alpha1 fails tests when built out-of-source #21999

Closed
thesamesam opened this issue Sep 7, 2023 · 39 comments
Closed

openssl-3.2.0-alpha1 fails tests when built out-of-source #21999

thesamesam opened this issue Sep 7, 2023 · 39 comments
Assignees
Labels
branch: master Merge to master branch branch: 3.2 Merge to openssl-3.2 triaged: bug The issue/pr is/fixes a bug

Comments

@thesamesam
Copy link
Contributor

In Gentoo, we build out-of-source for multilib as it makes life a lot easier (and it's a bit quicker).

In 3.2.0-alpha1, tests seem to fail in this configuration:

  1. cd /tmp
  2. tar xvf openssl-3.2.0-alpha1.tar.xz
  3. mkdir build && cd build
  4. /tmp/openssl-3.2.0-alpha1/config && make -j$(nproc) && make test -j$(nproc) HARNESS_JOBS="-j$(nproc)" VFP=1 -Onone
Test Summary Report                                                                                                                                                                                   [313/9610]
-------------------
01-test_sanity.t                      (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
01-test_symbol_presence.t             (Wstat: 512 (exited 2) Tests: 3 Failed: 2)
  Failed tests:  2-3
  Non-zero exit status: 2
01-test_test.t                        (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
02-test_errstr.t                      (Wstat: 34816 (exited 136) Tests: 137 Failed: 136)
  Failed tests:  1-136
  Non-zero exit status: 136
02-test_lhash.t                       (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
02-test_list.t                        (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
02-test_localetest.t                  (Wstat: 768 (exited 3) Tests: 3 Failed: 3)
  Failed tests:  1-3
  Non-zero exit status: 3
02-test_priority_queue.t              (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
02-test_stack.t                       (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
03-test_exdata.t                      (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
03-test_internal_ssl_cert_table.t     (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
03-test_params_api.t                  (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
03-test_property.t                    (Wstat: 256 (exited 1) Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
03-test_ui.t                          (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_asn1_decode.t                 (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_asn1_encode.t                 (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_asn1_string_table.t           (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_bio_callback.t                (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_bio_core.t                    (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_bio_dgram.t                   (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_bioprint.t                    (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_conf.t                        (Wstat: 512 (exited 2) Tests: 4 Failed: 2)
  Failed tests:  1, 3
  Non-zero exit status: 2
04-test_err.t                         (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_membio.t                      (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_params_conversion.t           (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_pem_read_depr.t               (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
04-test_pem_reading.t                 (Wstat: 6400 (exited 25) Tests: 55 Failed: 25)
  Failed tests:  1-3, 5, 7, 10-22, 25-26, 30, 47, 52, 54-55
  Non-zero exit status: 25
04-test_provider_default_search_path.t (Wstat: 256 (exited 1) Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=291, Tests=3580, 299 wallclock secs ( 3.95 usr  1.00 sys + 191.26 cusr 79.49 csys = 275.70 CPU)
Result: FAIL
$ perl configdata.pm --dump

Command line (with current working directory = .):

    /usr/bin/perl ../openssl-3.2.0-alpha1/Configure

Perl information:

    /usr/bin/perl
    5.38.0 for x86_64-linux

Enabled features:

    afalgeng
    apps
    argon2
    aria
    asm
    async
    autoalginit
    autoerrinit
    autoload-config
    bf
    blake2
    bulk
    cached-fetch
    camellia
    capieng
    cast
    chacha
    cmac
    cmp
    cms
    comp
    ct
    default-thread-pool
    deprecated
    des
    dgram
    dh
    docs
    dsa
    dso
    dtls
    dynamic-engine
    ec
    ec2m
    ecdh
    ecdsa
    ecx
    engine
    err
    filenames
    gost
    http
    idea
    legacy
    loadereng
    makedepend
    md4
    mdc2
    module
    multiblock
    nextprotoneg
    ocb
    ocsp
    padlockeng
    pic
    pinshared
    poly1305
    posix-io
    psk
    quic
    rc2
    rc4
    rdrand
    rfc3779
    rmd160
    scrypt
    secure-memory
    seed
    shared
    siphash
    siv
    sm2
    sm2-precomp
    sm3
    sm4
    sock
    srp
    srtp
    sse2
    ssl
    ssl-trace
    static-engine
    stdio
    tests
    thread-pool
    threads
    tls
    ts
    ui-console
    whirlpool
    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:

    acvp-tests          [cascade]        OPENSSL_NO_ACVP_TESTS
    asan                [default]        OPENSSL_NO_ASAN
    brotli              [default]        OPENSSL_NO_BROTLI
    brotli-dynamic      [default]        OPENSSL_NO_BROTLI_DYNAMIC
    buildtest-c++       [default]        
    winstore            [not-windows]    OPENSSL_NO_WINSTORE
    crypto-mdebug       [default]        OPENSSL_NO_CRYPTO_MDEBUG
    devcryptoeng        [default]        OPENSSL_NO_DEVCRYPTOENG
    ec_nistp_64_gcc_128 [default]        OPENSSL_NO_EC_NISTP_64_GCC_128
    egd                 [default]        OPENSSL_NO_EGD
    external-tests      [default]        OPENSSL_NO_EXTERNAL_TESTS
    fips                [default]        
    fips-securitychecks [cascade]        OPENSSL_NO_FIPS_SECURITYCHECKS
    fuzz-afl            [default]        OPENSSL_NO_FUZZ_AFL
    fuzz-libfuzzer      [default]        OPENSSL_NO_FUZZ_LIBFUZZER
    ktls                [default]        OPENSSL_NO_KTLS
    md2                 [default]        OPENSSL_NO_MD2 (skip crypto/md2)
    msan                [default]        OPENSSL_NO_MSAN
    rc5                 [default]        OPENSSL_NO_RC5 (skip crypto/rc5)
    sctp                [default]        OPENSSL_NO_SCTP
    tfo                 [default]        OPENSSL_NO_TFO
    trace               [default]        OPENSSL_NO_TRACE
    ubsan               [default]        OPENSSL_NO_UBSAN
    unit-test           [default]        OPENSSL_NO_UNIT_TEST
    uplink              [no uplink_arch] OPENSSL_NO_UPLINK
    weak-ssl-ciphers    [default]        OPENSSL_NO_WEAK_SSL_CIPHERS
    zlib                [default]        OPENSSL_NO_ZLIB
    zlib-dynamic        [default]        OPENSSL_NO_ZLIB_DYNAMIC
    zstd                [default]        OPENSSL_NO_ZSTD
    zstd-dynamic        [default]        OPENSSL_NO_ZSTD_DYNAMIC
    ssl3                [default]        OPENSSL_NO_SSL3
    ssl3-method         [default]        OPENSSL_NO_SSL3_METHOD

Config target attributes:

    AR => "ar",
    ARFLAGS => "qc",
    CC => "gcc",
    CFLAGS => "-Wall -O3",
    CXX => "g++",
    CXXFLAGS => "-Wall -O3",
    HASHBANGPERL => "/usr/bin/env perl",
    RANLIB => "ranlib",
    RC => "windres",
    asm_arch => "x86_64",
    bn_ops => "SIXTY_FOUR_BIT_LONG",
    build_file => "Makefile",
    build_scheme => [ "unified", "unix" ],
    cflags => "-pthread -m64",
    cppflags => "",
    cxxflags => "-std=c++11 -pthread -m64",
    defines => [ "OPENSSL_BUILDING_OPENSSL" ],
    disable => [  ],
    dso_ldflags => "-Wl,-z,defs",
    dso_scheme => "dlfcn",
    enable => [ "afalgeng" ],
    ex_libs => "-ldl -pthread",
    includes => [  ],
    lflags => "",
    lib_cflags => "",
    lib_cppflags => "-DOPENSSL_USE_NODELETE -DL_ENDIAN",
    lib_defines => [  ],
    module_cflags => "-fPIC",
    module_cxxflags => undef,
    module_ldflags => "-Wl,-znodelete -shared -Wl,-Bsymbolic",
    multilib => "64",
    perl_platform => "Unix",
    perlasm_scheme => "elf",
    shared_cflag => "-fPIC",
    shared_defflag => "-Wl,--version-script=",
    shared_defines => [  ],
    shared_ldflag => "-Wl,-znodelete -shared -Wl,-Bsymbolic",
    shared_rcflag => "",
    shared_sonameflag => "-Wl,-soname=",
    shared_target => "linux-shared",
    thread_defines => [  ],
    thread_scheme => "pthreads",
    unistd => "<unistd.h>",

Recorded environment:

    AR = 
    ARFLAGS = 
    AS = 
    ASFLAGS = 
    BUILDFILE = 
    CC = 
    CFLAGS = 
    CPP = 
    CPPDEFINES = 
    CPPFLAGS = 
    CPPINCLUDES = 
    CROSS_COMPILE = 
    CXX = 
    CXXFLAGS = 
    HASHBANGPERL = 
    LD = 
    LDFLAGS = 
    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         = qc
    ASFLAGS         = 
    CC              = gcc
    CFLAGS          = -Wall -O3
    CPPDEFINES      = 
    CPPFLAGS        = 
    CPPINCLUDES     = 
    CXX             = g++
    CXXFLAGS        = -Wall -O3
    HASHBANGPERL    = /usr/bin/env perl
    LDFLAGS         = 
    LDLIBS          = 
    PERL            = /usr/bin/perl
    RANLIB          = ranlib
    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:

    ../openssl-3.2.0-alpha1/Configurations/common0.tmpl
    ../openssl-3.2.0-alpha1/Configurations/unix-Makefile.tmpl
@thesamesam thesamesam added the issue: bug report The issue was opened to report a bug label Sep 7, 2023
@hlandau hlandau self-assigned this Sep 7, 2023
@hlandau hlandau added triaged: bug The issue/pr is/fixes a bug and removed issue: bug report The issue was opened to report a bug labels Sep 7, 2023
@hlandau
Copy link
Member

hlandau commented Sep 7, 2023

Not able to reproduce this currently. That doesn't mean this isn't a real issue, but maybe I don't have enough parallelism on this system to reproduce it.

The most likely cause is some kind of race condition around make test when used concurrently. Avoiding the use of HARNESS_JOBS is a likely workaround for now. There are certainly some slight bugs in concurrent use of make test.

Consider adding V=1 to make test to get verbose logging. This might give some hints.

@thesamesam
Copy link
Contributor Author

I'll poke a bit more now, but while I do, here's a log from a failure in our packaging w/ VFP=1 which should have the details for failures at least: build.log.gz.

@hlandau
Copy link
Member

hlandau commented Sep 7, 2023

../../test/exptest: error while loading shared libraries: ../../util/../util/../libcrypto.so.3: file too short

A possible issue here is running the tests while libcrypto.so.3 is still being written. That's a bit odd since that should be done as part of make. Given the invocation you list above it's hard to see how it could happen.

Is it possible libcrypto.so.3 is corrupted in some way? Would you be able to examine things in the build environment after the failure and see if it looks right? If you can get a shell in the build environment (and this isn't in some fully automated build process) you could also see if running make test again works.

@mattcaswell
Copy link
Member

Hmmm. I also just tried this and have been unable to reproduce it here either.

@thesamesam
Copy link
Contributor Author

thesamesam commented Sep 7, 2023

I'm going to play with this over the weekend and dig into it. I can still reproduce it in one environment consistently, others are more picky.

Please don't worry about this bug until I've had a chance to give an update and hopefully some useful info over the next few days. Cheers!

@mattcaswell
Copy link
Member

@thesamesam - do you have an update for us on this issue?

@t8m
Copy link
Member

t8m commented Oct 9, 2023

No update, closing. If it still happens with alpha2 or fresh master branch checkout, please reopen.

@t8m t8m closed this as completed Oct 9, 2023
@nvinson
Copy link

nvinson commented Oct 17, 2023

retested using master:

I get the result:

x86_64-pc-linux-gnu-ld: error: libcrypto.ld:1: unexpected EOF
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Steps to reproduce:

  1. checkout master
  2. mkdir build_{32,64}
  3. cd build_32
  4. perl /var/tmp/portage/dev-libs/openssl-3.2.0_alpha2/work/openssl-3.2.0-alpha2/Configure linux-x86-clang enable-camellia enable-ec enable-ec2m enable-sm2 enable-srp enable-idea enable-mdc2 enable-rc5 enable-asm no-ktls no-rfc3779 no-sctp no-tests no-zlib no-weak-ssl-ciphers --prefix=/usr --openssldir=/etc/ssl --libdir=lib shared threads
  5. cd ../build_64
  6. perl /var/tmp/portage/dev-libs/openssl-3.2.0_alpha2/work/openssl-3.2.0-alpha2/Configure linux-x86_64-clang enable-camellia enable-ec enable-ec2m enable-sm2 enable-srp enable-idea enable-mdc2 enable-rc5 enable-asm no-ktls no-rfc3779 no-sctp no-tests no-zlib no-weak-ssl-ciphers --prefix=/usr --openssldir=/etc/ssl --libdir=lib shared threads
  7. cd ../build_32
  8. make V=1 -j2 build_sw
  9. cd ../build_64
  10. make V=1 -j2 build_sw
  11. cd ../build_32
  12. make V=1 -j2 install_sw
  13. observe link failure: x86_64-pc-linux-gnu-ld: error: libcrypto.ld:1: unexpected EOF; clang: error: linker command failed with exit code 1 (use -v to see invocation)

Note: https://github.com/nvinson/openssl/tree/unix-Makefile.tmpl_fix includes a patch that alters how libcrypto.ld is created by writing the file to libcrypto.ld.tmp, and moving libcyrpto.ld.tmp to libcyrpto.ld when file is complete. This results in build failures due to libcrypto.ld.tmp is missing.

configure.pm dump

Command line (with current working directory = .):

    /usr/bin/perl ../Configure linux-x86-clang enable-camellia enable-ec enable-ec2m enable-sm2 enable-srp enable-idea enable-mdc2 enable-rc5 enable-asm no-ktls no-rfc3779 no-sctp no-tests no-zlib no-weak-ssl-ciphers --prefix=/usr --openssldir=/etc/ssl --libdir=lib shared threads

Perl information:

    /usr/bin/perl
    5.38.0 for x86_64-linux

Enabled features:

    afalgeng
    apps
    argon2
    aria
    asm
    async
    autoalginit
    autoerrinit
    autoload-config
    bf
    blake2
    bulk
    cached-fetch
    camellia
    capieng
    cast
    chacha
    cmac
    cmp
    cms
    comp
    ct
    default-thread-pool
    deprecated
    des
    dgram
    dh
    docs
    dsa
    dso
    dtls
    dynamic-engine
    ec
    ec2m
    ecdh
    ecdsa
    ecx
    engine
    err
    filenames
    gost
    http
    idea
    legacy
    loadereng
    makedepend
    md4
    mdc2
    module
    multiblock
    nextprotoneg
    ocb
    ocsp
    padlockeng
    pic
    pinshared
    poly1305
    posix-io
    psk
    quic
    rc2
    rc4
    rc5
    rdrand
    rmd160
    scrypt
    secure-memory
    seed
    shared
    siphash
    siv
    sm2
    sm2-precomp
    sm3
    sm4
    sock
    srp
    srtp
    sse2
    ssl
    ssl-trace
    static-engine
    stdio
    thread-pool
    threads
    tls
    ts
    ui-console
    whirlpool
    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:

    acvp-tests          [cascade]        OPENSSL_NO_ACVP_TESTS
    asan                [default]        OPENSSL_NO_ASAN
    brotli              [default]        OPENSSL_NO_BROTLI
    brotli-dynamic      [default]        OPENSSL_NO_BROTLI_DYNAMIC
    buildtest-c++       [default]        
    winstore            [not-windows]    OPENSSL_NO_WINSTORE
    crypto-mdebug       [default]        OPENSSL_NO_CRYPTO_MDEBUG
    devcryptoeng        [default]        OPENSSL_NO_DEVCRYPTOENG
    ec_nistp_64_gcc_128 [default]        OPENSSL_NO_EC_NISTP_64_GCC_128
    egd                 [default]        OPENSSL_NO_EGD
    external-tests      [default]        OPENSSL_NO_EXTERNAL_TESTS
    fips                [default]        
    fips-securitychecks [cascade]        OPENSSL_NO_FIPS_SECURITYCHECKS
    fuzz-afl            [default]        OPENSSL_NO_FUZZ_AFL
    fuzz-libfuzzer      [default]        OPENSSL_NO_FUZZ_LIBFUZZER
    ktls                [option]         OPENSSL_NO_KTLS
    md2                 [default]        OPENSSL_NO_MD2 (skip crypto/md2)
    msan                [default]        OPENSSL_NO_MSAN
    rfc3779             [option]         OPENSSL_NO_RFC3779
    sctp                [option]         OPENSSL_NO_SCTP
    tests               [option]         OPENSSL_NO_TESTS
    tfo                 [default]        OPENSSL_NO_TFO
    trace               [default]        OPENSSL_NO_TRACE
    ubsan               [default]        OPENSSL_NO_UBSAN
    unit-test           [default]        OPENSSL_NO_UNIT_TEST
    uplink              [no uplink_arch] OPENSSL_NO_UPLINK
    weak-ssl-ciphers    [option]         OPENSSL_NO_WEAK_SSL_CIPHERS
    zlib                [option]         OPENSSL_NO_ZLIB
    zlib-dynamic        [default]        OPENSSL_NO_ZLIB_DYNAMIC
    zstd                [default]        OPENSSL_NO_ZSTD
    zstd-dynamic        [default]        OPENSSL_NO_ZSTD_DYNAMIC
    ssl3                [default]        OPENSSL_NO_SSL3
    ssl3-method         [default]        OPENSSL_NO_SSL3_METHOD

Config target attributes:

    AR => "ar",
    ARFLAGS => "qc",
    CC => "clang",
    CFLAGS => "-Wall -O3 -fomit-frame-pointer",
    CXX => "clang++",
    CXXFLAGS => "-Wall -O3",
    HASHBANGPERL => "/usr/bin/env perl",
    RANLIB => "ranlib",
    RC => "windres",
    asm_arch => "x86",
    bn_ops => "BN_LLONG",
    build_file => "Makefile",
    build_scheme => [ "unified", "unix" ],
    cflags => "-pthread -m32",
    cppflags => "",
    cxxflags => "-std=c++11 -pthread -m32",
    defines => [ "OPENSSL_BUILDING_OPENSSL" ],
    disable => [  ],
    dso_ldflags => "-Wl,-z,defs",
    dso_scheme => "dlfcn",
    enable => [ "afalgeng" ],
    ex_libs => "-ldl -pthread -latomic",
    includes => [  ],
    lflags => "",
    lib_cflags => "",
    lib_cppflags => "-DOPENSSL_USE_NODELETE -DL_ENDIAN",
    lib_defines => [  ],
    module_cflags => "-fPIC",
    module_cxxflags => undef,
    module_ldflags => "-Wl,-znodelete -shared -Wl,-Bsymbolic",
    perl_platform => "Unix",
    perlasm_scheme => "elf",
    shared_cflag => "-fPIC",
    shared_defflag => "-Wl,--version-script=",
    shared_defines => [  ],
    shared_ldflag => "-Wl,-znodelete -shared -Wl,-Bsymbolic",
    shared_rcflag => "",
    shared_sonameflag => "-Wl,-soname=",
    shared_target => "linux-shared",
    thread_defines => [  ],
    thread_scheme => "pthreads",
    unistd => "<unistd.h>",

Recorded environment:

    AR = 
    ARFLAGS = 
    AS = 
    ASFLAGS = 
    BUILDFILE = 
    CC = 
    CFLAGS = 
    CPP = 
    CPPDEFINES = 
    CPPFLAGS = 
    CPPINCLUDES = 
    CROSS_COMPILE = 
    CXX = 
    CXXFLAGS = 
    HASHBANGPERL = 
    LD = 
    LDFLAGS = 
    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         = qc
    ASFLAGS         = 
    CC              = clang
    CFLAGS          = -Wall -O3 -fomit-frame-pointer
    CPPDEFINES      = 
    CPPFLAGS        = 
    CPPINCLUDES     = 
    CXX             = clang++
    CXXFLAGS        = -Wall -O3
    HASHBANGPERL    = /usr/bin/env perl
    LDFLAGS         = 
    LDLIBS          = 
    PERL            = /usr/bin/perl
    RANLIB          = ranlib
    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

@mattcaswell mattcaswell reopened this Oct 17, 2023
@mattcaswell mattcaswell added this to the 3.2.0 milestone Oct 17, 2023
@arapov arapov assigned levitte and unassigned hlandau Oct 19, 2023
@levitte
Copy link
Member

levitte commented Oct 19, 2023

This may mean that we have a diamond dependency on some .ld files. I thought we had managed to avoid that, but it may have slipped in... can that be verified somehow?

Come to think of it, I don't quite believe this, as that would have had an impact on things like make -j8, something I do on a daily basis...

@thesamesam
Copy link
Contributor Author

Both myself and @nvinson are sort of stunned here as well and don't really get it. I didn't reopen it immediately earlier because I wanted to try get something more useful to debug it and have so far failed. @nvinson managed to later come up with that recipe which implies something is mangling the source dir.

@levitte
Copy link
Member

levitte commented Oct 19, 2023

It's possible that running make -j2 build_sw twice fixes the problem. I dunno, and that's a work-around that shouldn't be necessary most of the times, but I've had to when jumping around different branches in the same source directory.

Another thing: never do parallel make with the install targets. We do have diamond dependencies there which are hard to resolve cleanly... and installation shouldn't normally need to be done in parallel anyway.

@thesamesam
Copy link
Contributor Author

(I'll add -j1 to the calls in our packaging for make install* now. I think the only painful bit there is the doc/man page install. Thanks for the heads up.)

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Oct 19, 2023
See openssl/openssl#21999 (comment) -
upstream say parallelism isn't supported for the install targets.

Bug: openssl/openssl#21999
Signed-off-by: Sam James <sam@gentoo.org>
@levitte
Copy link
Member

levitte commented Oct 30, 2023

Can this be closed?

@thesamesam
Copy link
Contributor Author

No, I only addressed the aside you mentioned for install in our packaging.

It still happens for me with tests as originally reported. @nvinson's reproducer might work as well with test instead of install, not tried.

@nhorman
Copy link
Contributor

nhorman commented Oct 31, 2023

silly question: Are you running on a smaller system, or in a containerized environment? I ask because this failure
Suggests to me that you might be running out of disk space.

Can you recreate the issue, and run df immediately after the issue reproduces?

@thesamesam
Copy link
Contributor Author

My assumption has been that's from two runs of the generator and there's no locking/a missing dependency.

No, I'm not running out of disk, or ram (just checked).

@thesamesam
Copy link
Contributor Author

thesamesam commented Oct 31, 2023

I haven't tried a revert of it, but @nvinson tried to bisect it and came out with 0e55c3a (cc @DDvO).

That led to #19087 and #19179.

@nvinson
Copy link

nvinson commented Oct 31, 2023

silly question: Are you running on a smaller system, or in a containerized environment? I ask because this failure
Suggests to me that you might be running out of disk space.

Neither disk nor memory was an issue.

% df .  
Filesystem                  1K-blocks      Used  Available Use% Mounted on
/dev/mapper/data_core-home 3780315676 625440120 3154875556  17% /home
Portage 3.0.54 (python 3.11.6-final-0, default/linux/amd64/17.1/desktop, gcc-13, glibc-2.38-r7, 6.5.5-gentoo x86_64)
=================================================================
System uname: Linux-6.5.5-gentoo-x86_64-Intel-R-_Core-TM-_i7-4771_CPU_@_3.50GHz-with-glibc2.38
KiB Mem:    32553220 total,  16642084 free
KiB Swap:    2097148 total,   2066696 free
Timestamp of repository gentoo: Tue, 31 Oct 2023 06:46:55 +0000
Head commit of repository gentoo: ba9e0598fad6e6b64fa0151df80351e0fd0ea9c9

Timestamp of repository brother-overlay: Sun, 29 Oct 2023 04:03:04 +0000
Head commit of repository brother-overlay: 4d263f5a54b791355fc860c6bac6fe37c0f74eb6

Head commit of repository magpie: dab2e96d48b44bac1bbdcab3e52685145a1f5ba3

sh bash 5.2_p15-r7
ld GNU ld (Gentoo 2.41 p2) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r7::gentoo
dev-java/java-config:      2.3.1-r1::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.10.13::gentoo, 3.11.6::gentoo, 3.12.0_p1::gentoo
dev-lang/rust:             1.73.0::gentoo
dev-util/cmake:            3.27.7::gentoo
dev-util/meson:            1.2.3::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/openrc:           0.51::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.41-r2::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo, 17.0.3::gentoo
sys-devel/gcc:             13.2.1_p20231014::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.6::gentoo, 17.0.3::gentoo
sys-devel/llvm:            16.0.6::gentoo, 17.0.3::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.5-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r7::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    volatile: False
    sync-git-verify-commit-signature: true

brother-overlay
    location: /var/db/repos/brother-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/brother-overlay.git
    masters: gentoo
    volatile: False

magpie
    location: /var/db/repos/magpie
    sync-type: git
    sync-uri: https://github.com/nvinson/magpie.git
    masters: gentoo
    volatile: False

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
AR="llvm-ar"
CBUILD="x86_64-pc-linux-gnu"
CC="clang"
CFLAGS="-march=native -O3 -pipe -flto=thin"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /opt/brother/scanner/brscan4/brsanenetdevice4.cfg /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXX="clang++"
CXXFLAGS="-march=native -O3 -pipe -flto=thin"
DISTDIR="/var/cache/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=native -O3 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O3 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind"
LEX="flex"
MAKEOPTS="-j8"
NM="llvm-nm"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
RANLIB="llvm-ranlib"
SHELL="/bin/zsh"
USE="X a52 aac acl acpi alsa amd64 branding bzip2 cairo cdda cdr clang cleartype cli corefonts crypt cups dbus dri dts dvd dvdr elogind encode exif flac fortran gdbm gif glamor gpm gtk gui iconv icu ipv6 jpeg lcms libnotify libtirpc lto mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt5 readline sdl seccomp sound spell split-usr ssl startup-notification svg test-rust theora tiff truetype udev udisks unicode upower usb vaapi vorbis vpx vulkan wxwidgets x264 xattr xcb xft xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en-US en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, ARFLAGS, AS, ASFLAGS, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

@nvinson
Copy link

nvinson commented Oct 31, 2023

Reverting 0e55c3a seems to fix the problem for me.

@mattcaswell
Copy link
Member

@levitte

@levitte
Copy link
Member

levitte commented Nov 1, 2023

Reverting 0e55c3a seems to fix the problem for me.

This suggests a time stamp issue, 'cause this commit should not affect day-to-day building... but could potentially do so still if the .num files are deemed newer than whatever depends on them, or if anything they depend on is deemed to be newer than them.

@levitte
Copy link
Member

levitte commented Nov 1, 2023

Just out of curiousity, what happens if you build 3.2.0 pre-release (alpha 1 or beta 1, it shouldn't matter) without the parallelism, i.e. without -j${nproc}? If that does build and test cleanly, then it's clear that we have a parallelism issue (most likely some sort of diamond dependency, which is never good).

Could you please try that?

@nvinson
Copy link

nvinson commented Nov 1, 2023

@levitte I have never reproduced this bug using -j1 for any version. I have always needed -j2 or higher to reproduce.

@thesamesam
Copy link
Contributor Author

Yes, a serial build works fine.

@t8m
Copy link
Member

t8m commented Nov 1, 2023

Does dropping -jx from make test help?

@nvinson
Copy link

nvinson commented Nov 1, 2023

There seems to be a misunderstanding about the conditions needed to trigger this bug. Therefore, let me make it clear

-j2 or higher is needed to trigger the bug

Neither @thesamesam nor I have observed this bug while building a valid make target when make was invoked with -j1 or without the -j flag.

@t8m
Copy link
Member

t8m commented Nov 2, 2023

@nvinson I run make -j8 or -j16 all the time on out-of-source builds and I've never seen this. However I never use -j with make test. It is also pointless as if you run make first followed by make test there should be practically no difference as the tests are run in parallel by setting HARNESS_JOBS=<num> and not by using parallel make.

@t8m
Copy link
Member

t8m commented Nov 2, 2023

BTW you have wrong command in the issue description as it should be HARNESS_JOBS="$(nproc)" not with -j.

@DDvO
Copy link
Contributor

DDvO commented Nov 2, 2023

@nvinson wrote:

make V=1 -j2 build_sw

Using make with -jn where n != 1 typically fails on a 'clean' or freshly (re-)configured OpenSSL directory.
This has to do with the build_generated part of build_sw, which must finish first before starting with the depend or _build_sw targets.

This should work fine:
make build_generated && make -j2 ...

So what I usually do is:
make -s build_generated && make -s -j4, possibly followed by make test

@mattcaswell
Copy link
Member

Using make with -jn where n != 1 typically fails on a 'clean' or freshly (re-)configured OpenSSL directory.

Really??? I build with make -jn all the time, but have never experienced that? Sounds like a separate issue though.

@nvinson
Copy link

nvinson commented Nov 2, 2023

@DDvO wrote:

Using make with -jn where n != 1 typically fails on a 'clean' or freshly (re-)configured OpenSSL directory. This has to do with the build_generated part of build_sw, which must finish first before starting with the depend or _build_sw targets.

This should work fine: make build_generated && make -j2 ...

So what I usually do is: make -s build_generated && make -s -j4, possibly followed by make test

This appears to work. I'll run it a few more times to be sure.

@DDvO
Copy link
Contributor

DDvO commented Nov 2, 2023

Using make with -jn where n != 1 typically fails on a 'clean' or freshly (re-)configured OpenSSL directory.

Really??? I build with make -jn all the time, but have never experienced that? Sounds like a separate issue though.

Ah, looks like this meanwhile has improved!
For both master and the latest openssl-3.0, I cannot reproduce anymore that make build_generated is helpful.

@t8m
Copy link
Member

t8m commented Nov 21, 2023

Not a 3.2.0 blocker -> removing the milestone.

@t8m t8m removed this from the 3.2.0 milestone Nov 21, 2023
@t8m t8m added branch: master Merge to master branch branch: 3.2 Merge to openssl-3.2 labels Nov 21, 2023
@thesamesam
Copy link
Contributor Author

thesamesam commented Nov 21, 2023

I'm not sure why it's not a blocker, as it's a regression for us and it's meant we hadn't been able to test any of it.

Running tests with -j1 seems to be a fair bit slower because actually compiling them takes a while but I guess it's a workaround.

@hlandau
Copy link
Member

hlandau commented Nov 21, 2023

I'm not sure why it's not a blocker, as it's a regression for us and it's meant we hadn't been able to test any of it.

Running tests with -j1 seems to be a fair bit slower because actually compiling them takes a while but I guess it's a workaround.

You can build the tests first with make -jn and then run make test -j1. Though I suspect make test -jn will also work here. Personally I tend to use make && make test.

@thesamesam
Copy link
Contributor Author

I think we are doing that, though. But I'll check again.

@thesamesam
Copy link
Contributor Author

So far, it seems fine with -j1 just on the make test ... invocation. I must have either made a mistake when looking at the output before (thinking it was being slow and rebuilding tests unnecessarily) or I did -j1 for the whole lot when testing and confused the two. So, good enough for us. Thanks.

@hlandau
Copy link
Member

hlandau commented Nov 21, 2023

+1. FWIW when developing I always find running 'make test' after changing a file to result in trying to run some test binaries before they are actually finished compiling, resulting in an error, which is why I always run make && make test. We should fix that.

@levitte
Copy link
Member

levitte commented Nov 28, 2023

That's an odd one, @hlandau.

This issue should really be closed, perhaps after raising a few topical ones from the details we've found here.

openssl-machine pushed a commit that referenced this issue Dec 2, 2023
$(SRCDIR)/util/libcrypto.num and $(SRCDIR)/util/libssl.num were made their
own targets to have 'make ordinals' reproduce them (run mknum.pl) only if
needed.

Unfortunately, because the shared library linker scripts depend on these
.num files, we suddenly have mknum.pl run at random times when building.
Furthermore, this created a diamond dependency, which disturbs parallell
building because multiple mknum.pl on the same file could run at the same
time.

This reverts commit 0e55c3a.

Fixes #21999
Partially fixes #22841

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #22890)

(cherry picked from commit c08b21a)
wbeck10 pushed a commit to wbeck10/openssl that referenced this issue Jan 8, 2024
$(SRCDIR)/util/libcrypto.num and $(SRCDIR)/util/libssl.num were made their
own targets to have 'make ordinals' reproduce them (run mknum.pl) only if
needed.

Unfortunately, because the shared library linker scripts depend on these
.num files, we suddenly have mknum.pl run at random times when building.
Furthermore, this created a diamond dependency, which disturbs parallell
building because multiple mknum.pl on the same file could run at the same
time.

This reverts commit 0e55c3a.

Fixes openssl#21999
Partially fixes openssl#22841

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from openssl#22890)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch: master Merge to master branch branch: 3.2 Merge to openssl-3.2 triaged: bug The issue/pr is/fixes a bug
Projects
Status: Done
Development

No branches or pull requests

8 participants