<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello,<br><br>Starting from the rsa choice "rsa2048", there is crash due to segment fault when running speed.  RSA512 and rsa1024 doesn't have this issue. <br><br>Following is the call stacks, registers info when crash happened. It shows that the register %rbp is zero at that point. The value of %rbp is set by instruction "movq    %xmm2,$nptr " in label .L8x_no_tail. I don't understand how the algorithm in the x86_64-mont5.s works. So i have no idea why a zero value of %xmm2 was moved to %rbp at that point. Please help have a look.<br><br>(wrdbg) <b>bt</b><br>#0  0x0000000000242d23 at __bn_sqrx8x_reduction+0x6c<br>#1  0x000000000023f96b at bn_sqr8x_mont+0xcb<br>#2  0x000000000023b014 at bn_mul_mont_fixed_top+0x64<br>#3  0x00000000002b61f5 at BN_mod_exp_mont+0x445<br>#4  0x0000000000281b1f at rsa_ossl_public_decrypt+0x28f<br>#5  0x0000000000285c0a at int_rsa_verify+0x8a<br>#6  0x0000000000285f92 at RSA_verify+0x32<br>#7  0x0000000000217963 at RSA_verify_loop+0x53<br>#8  0x00000000002176d8 at run_benchmark+0x108<br>#9  0x0000000000212e80 at speed_main+0x1400<br>#10 0x0000000000201411 in main (argc=1, argv=0x68ff20) at rtp.c:33<br>#11 0x0000000000201073 at _start+0x72<br>(wrdbg) <b>info registers</b><br>  rax             0x0000000000000000  0                                 <br>  rdx             0x68f8f88932a43dc0  7564068842312580544                        <br>  rcx             0xfffffffffffffff8  18446744073709551608                        <br>  rbx             0x123959978a8b3640  1313179273754523200                        <br>  rsi             0x0000000000000000  0                                 <br>  rdi             0x0000000000688430  6849584                           <br>  rbp            <span style="color: rgb(255, 0, 0);"> 0x0000000000000000  0  </span>                               <br>  rsp             0x00000000006883b8  6849464                           <br>  r8              0x123959978a8b3640  1313179273754523200                        <br>  r9              0xf7a5b45905344009  17844867392957857801                        <br>  r10             0x73dbc32a132b324b  8348480919738987083                        <br>  r11             0x37cda4961a791379  4021051006907913081                        <br>  r12             0x701103ae9d18bf8a  8075239655346847626                        <br>  r13             0xbfbd1a5d2ab85477  13816228219293553783                        <br>  r14             0x3f3610a53ecd4756  4554846375041124182                        <br>  r15             0xea5e26bc1a343a39  16887978242021276217                        <br>  rip             0x0000000000242d23  2370851                           PC<br>  eflags          0x00000246          582        [ pf zf if ]           <br>  fpu                                 None                              <br>  xmm                                 None      <br><br>                  __bn_sqrx8x_reduction:<br>0000000000242cb7:   xor     eax, eax<br>0000000000242cb9:   mov     rbx, qword ptr [rsp+0x28]<br>0000000000242cbe:   mov     rdx, qword ptr [rsp+0x38]<br>0000000000242cc3:   lea     rcx, ptr [rbp+r9*1-0x40]<br>0000000000242cc8:   mov     qword ptr [rsp+0x8], rcx<br>0000000000242ccd:   mov     qword ptr [rsp+0x10], rdi<br>0000000000242cd2:   lea     rdi, ptr [rsp+0x38]<br>0000000000242cd7:   jmp     0x242ce0 <__bn_sqrx8x_reduction+41><br>0000000000242cd9:   nop     dword ptr [rax], eax<br>0000000000242ce0:   mov     r9, qword ptr [rdi+0x8]<br>0000000000242ce4:   mov     r10, qword ptr [rdi+0x10]<br>0000000000242ce8:   mov     r11, qword ptr [rdi+0x18]<br>0000000000242cec:   mov     r12, qword ptr [rdi+0x20]<br>0000000000242cf0:   mov     r8, rdx<br>0000000000242cf3:   imul    rdx, rbx<br>0000000000242cf7:   mov     r13, qword ptr [rdi+0x28]<br>0000000000242cfb:   mov     r14, qword ptr [rdi+0x30]<br>0000000000242cff:   mov     r15, qword ptr [rdi+0x38]<br>0000000000242d03:   mov     qword ptr [rsp+0x20], rax<br>0000000000242d08:   lea     rdi, ptr [rdi+0x40]<br>0000000000242d0c:   xor     rsi, rsi<br>0000000000242d0f:   mov     rcx, -8<br>0000000000242d16:   jmp     0x242d20 <__bn_sqrx8x_reduction+105><br>0000000000242d18:   nop     dword ptr [rax+rax*1], eax<br>0000000000242d20:   mov     rbx, r8<br><span style="color: rgb(255, 0, 0);">0000000000242d23:   mulx    r8, rax, qword ptr [rbp]</span><br>0000000000242d29:   adcx    rax, rbx<br>0000000000242d2f:   adox    r8, r9<br><br><span style="color: rgb(255, 0, 0);">L8x_no_tail:</span><br>    adc 8*0($tptr),%r8<br>    adc 8*1($tptr),%r9<br>    adc 8*2($tptr),%r10<br>    adc 8*3($tptr),%r11<br>    adc 8*4($tptr),%r12<br>    adc 8*5($tptr),%r13<br>    adc 8*6($tptr),%r14<br>    adc 8*7($tptr),%r15<br>    adc \$0,%rax        # top-most carry<br>     mov    -8($nptr),%rcx      # np[num-1]<br>     xor    $carry,$carry<br>   <span style="color: rgb(255, 0, 0);"> movq    %xmm2,$nptr     # restore $nptr</span><br>    mov %r8,8*0($tptr)      # store top 512 bits<br>    mov %r9,8*1($tptr)<br>     movq   %xmm3,$num      # $num is %r9, can't be moved upwards<br><br><br><b>configdata.pm --dump:<br></b>Command line (with current working directory = .):<br><br>    /usr/bin/perl ../Configure vxworks-x86-64 no-weak-ssl-ciphers no-aria no-blake2 no-camellia no-chacha no-cmac no-md2 no-md4 no-mdc2 no-ocb no-poly1305 no-rc2 no-rc5 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool no-autoerrinit no-comp no-sctp no-srtp --with-rand-seed=none -DOPENSSL_SYS_VXWORKS_SUPPORT -DVXWORKS_USER_SPACE -fPIC<br><br>Perl information:<br><br>    /usr/bin/perl<br>    5.22.1 for x86_64-linux-gnu-thread-multi<br><br>Enabled features:<br><br>    asm<br>    async<br>    autoalginit<br>    autoload-config<br>    bf<br>    capieng<br>    cast<br>    cms<br>    ct<br>    deprecated<br>    des<br>    dgram<br>    dh<br>    dsa<br>    dso<br>    dtls<br>    dynamic-engine<br>    ec<br>    ec2m<br>    ecdh<br>    ecdsa<br>    engine<br>    err<br>    filenames<br>    gost<br>    hw(-.+)?<br>    idea<br>    multiblock<br>    nextprotoneg<br>    ocsp<br>    pic<br>    posix-io<br>    psk<br>    rc4<br>    rdrand<br>    rfc3779<br>    rmd160<br>    shared<br>    sock<br>    srp<br>    sse2<br>    ssl<br>    static-engine<br>    stdio<br>    tests<br>    tls<br>    ts<br>    ui-console<br>    tls1<br>    tls1-method<br>    tls1_1<br>    tls1_1-method<br>    tls1_2<br>    tls1_2-method<br>    tls1_3<br>    dtls1<br>    dtls1-method<br>    dtls1_2<br>    dtls1_2-method<br><br>Disabled features:<br><br>    afalgeng                [not-linux]   <br>    aria                    [option]      OPENSSL_NO_ARIA (skip crypto/aria)<br>    asan                    [default]     OPENSSL_NO_ASAN<br>    autoerrinit             [option]      OPENSSL_NO_AUTOERRINIT<br>    blake2                  [option]      OPENSSL_NO_BLAKE2 (skip crypto/blake2)<br>    camellia                [option]      OPENSSL_NO_CAMELLIA (skip crypto/camellia)<br>    chacha                  [option]      OPENSSL_NO_CHACHA (skip crypto/chacha)<br>    cmac                    [option]      OPENSSL_NO_CMAC (skip crypto/cmac)<br>    comp                    [option]      OPENSSL_NO_COMP (skip crypto/comp)<br>    crypto-mdebug           [default]     OPENSSL_NO_CRYPTO_MDEBUG<br>    crypto-mdebug-backtrace [default]     OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE<br>    devcryptoeng            [default]     OPENSSL_NO_DEVCRYPTOENG<br>    ec_nistp_64_gcc_128     [default]     OPENSSL_NO_EC_NISTP_64_GCC_128<br>    egd                     [default]     OPENSSL_NO_EGD<br>    external-tests          [default]     OPENSSL_NO_EXTERNAL_TESTS<br>    fuzz-libfuzzer          [default]     OPENSSL_NO_FUZZ_LIBFUZZER<br>    fuzz-afl                [default]     OPENSSL_NO_FUZZ_AFL<br>    heartbeats              [default]     OPENSSL_NO_HEARTBEATS<br>    makedepend              [unavailable] <br>    md2                     [option]      OPENSSL_NO_MD2 (skip crypto/md2)<br>    md4                     [option]      OPENSSL_NO_MD4 (skip crypto/md4)<br>    mdc2                    [option]      OPENSSL_NO_MDC2 (skip crypto/mdc2)<br>    msan                    [default]     OPENSSL_NO_MSAN<br>    ocb                     [option]      OPENSSL_NO_OCB<br>    poly1305                [option]      OPENSSL_NO_POLY1305 (skip crypto/poly1305)<br>    rc2                     [option]      OPENSSL_NO_RC2 (skip crypto/rc2)<br>    rc5                     [option]      OPENSSL_NO_RC5 (skip crypto/rc5)<br>    scrypt                  [option]      OPENSSL_NO_SCRYPT<br>    sctp                    [option]      OPENSSL_NO_SCTP<br>    seed                    [option]      OPENSSL_NO_SEED (skip crypto/seed)<br>    siphash                 [option]      OPENSSL_NO_SIPHASH (skip crypto/siphash)<br>    sm2                     [option]      OPENSSL_NO_SM2 (skip crypto/sm2)<br>    sm3                     [option]      OPENSSL_NO_SM3 (skip crypto/sm3)<br>    sm4                     [option]      OPENSSL_NO_SM4 (skip crypto/sm4)<br>    srtp                    [option]      OPENSSL_NO_SRTP<br>    ssl-trace               [default]     OPENSSL_NO_SSL_TRACE<br>    threads                 [unavailable] <br>    ubsan                   [default]     OPENSSL_NO_UBSAN<br>    unit-test               [default]     OPENSSL_NO_UNIT_TEST<br>    whirlpool               [option]      <br>    weak-ssl-ciphers        [option]      OPENSSL_NO_WEAK_SSL_CIPHERS<br>    zlib                    [default]     <br>    zlib-dynamic            [default]     <br>    ssl3                    [default]     OPENSSL_NO_SSL3<br>    ssl3-method             [default]     OPENSSL_NO_SSL3_METHOD<br><br>Config target attributes:<br><br>    AR => "ar",<br>    ARFLAGS => "r",<br>    CC => "dummy",<br>    CFLAGS => "",<br>    HASHBANGPERL => "/usr/bin/env perl",<br>    RANLIB => "ranlib",<br>    RC => "windres",<br>    aes_asm_src => "aes-x86_64.s vpaes-x86_64.s bsaes-x86_64.s aesni-x86_64.s aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s",<br>    aes_obj => "aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o",<br>    apps_aux_src => "",<br>    apps_init_src => "",<br>    apps_obj => "",<br>    bf_asm_src => "bf_enc.c",<br>    bf_obj => "bf_enc.o",<br>    bn_asm_src => "asm/x86_64-gcc.c x86_64-mont.s x86_64-mont5.s x86_64-gf2m.s rsaz_exp.c rsaz-x86_64.s rsaz-avx2.s",<br>    bn_obj => "asm/x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o",<br>    bn_ops => "SIXTY_FOUR_BIT_LONG",<br>    build_file => "Makefile",<br>    build_scheme => [ "unified", "unix" ],<br>    cast_asm_src => "c_enc.c",<br>    cast_obj => "c_enc.o",<br>    cflags => "",<br>    chacha_asm_src => "chacha-x86_64.s",<br>    chacha_obj => "chacha-x86_64.o",<br>    cmll_asm_src => "cmll-x86_64.s cmll_misc.c",<br>    cmll_obj => "cmll-x86_64.o cmll_misc.o",<br>    cppflags => "\$(VSB_CONFIG_FILE_MACRO)",<br>    cpuid_asm_src => "x86_64cpuid.s",<br>    cpuid_obj => "x86_64cpuid.o",<br>    defines => [  ],<br>    des_asm_src => "des_enc.c fcrypt_b.c",<br>    des_obj => "des_enc.o fcrypt_b.o",<br>    disable => [  ],<br>    dso_extension => ".so",<br>    ec_asm_src => "ecp_nistz256.c ecp_nistz256-x86_64.s x25519-x86_64.s",<br>    ec_obj => "ecp_nistz256.o ecp_nistz256-x86_64.o x25519-x86_64.o",<br>    enable => [  ],<br>    exe_extension => "",<br>    includes => [  ],<br>    keccak1600_asm_src => "keccak1600-x86_64.s",<br>    keccak1600_obj => "keccak1600-x86_64.o",<br>    lflags => "",<br>    lib_cflags => "",<br>    lib_cppflags => "",<br>    lib_defines => [  ],<br>    md5_asm_src => "md5-x86_64.s",<br>    md5_obj => "md5-x86_64.o",<br>    modes_asm_src => "ghash-x86_64.s aesni-gcm-x86_64.s",<br>    modes_obj => "ghash-x86_64.o aesni-gcm-x86_64.o",<br>    module_cflags => "",<br>    module_cxxflags => "",<br>    module_ldflags => "-shared",<br>    padlock_asm_src => "e_padlock-x86_64.s",<br>    padlock_obj => "e_padlock-x86_64.o",<br>    poly1305_asm_src => "poly1305-x86_64.s",<br>    poly1305_obj => "poly1305-x86_64.o",<br>    rc4_asm_src => "rc4-x86_64.s rc4-md5-x86_64.s",<br>    rc4_obj => "rc4-x86_64.o rc4-md5-x86_64.o",<br>    rc5_asm_src => "rc5_enc.c",<br>    rc5_obj => "rc5_enc.o",<br>    rmd160_asm_src => "",<br>    rmd160_obj => "",<br>    sha1_asm_src => "sha1-x86_64.s sha256-x86_64.s sha512-x86_64.s sha1-mb-x86_64.s sha256-mb-x86_64.s",<br>    sha1_obj => "sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o",<br>    shared_cflag => "",<br>    shared_defines => [  ],<br>    shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",<br>    shared_extension_simple => ".so",<br>    shared_ldflag => "-shared",<br>    shared_rcflag => "",<br>    shared_target => "dummy",<br>    sys_id => "VXWORKS",<br>    thread_defines => [  ],<br>    thread_scheme => "(unknown)",<br>    unistd => "<unistd.h>",<br>    uplink_aux_src => "",<br>    uplink_obj => "",<br>    wp_asm_src => "wp-x86_64.s",<br>    wp_obj => "wp-x86_64.o",<br><br>Recorded environment:<br><br>    AR = <br>    BUILDFILE = <br>    CC = <br>    CROSS_COMPILE = <br>    CXX = <br>    HASHBANGPERL = <br>    OPENSSL_LOCAL_CONFIG_DIR = <br>    PERL = <br>    RANLIB = <br>    RC = <br>    WINDRES = <br>    __CNF_CFLAGS = <br>    __CNF_CPPDEFINES = <br>    __CNF_CPPFLAGS = <br>    __CNF_CPPINCLUDES = <br>    __CNF_CXXFLAGS = <br>    __CNF_LDFLAGS = <br>    __CNF_LDLIBS = <br><br>Makevars:<br><br>    AR              = ar<br>    ARFLAGS         = r<br>    CC              = dummy<br>    CFLAGS          = -fPIC<br>    CPPDEFINES      = OPENSSL_SYS_VXWORKS_SUPPORT VXWORKS_USER_SPACE<br>    CPPFLAGS        = <br>    CPPINCLUDES     = <br>    CXXFLAGS        = -fPIC<br>    HASHBANGPERL    = /usr/bin/env perl<br>    LDFLAGS         = <br>    LDLIBS          = <br>    PERL            = /usr/bin/perl<br>    RANLIB          = ranlib<br>    RC              = windres<br><br>NOTE: These variables only represent the configuration view.  The build file<br>template may have processed these variables further, please have a look at the<br>build file for more exact data:<br>    Makefile<br><br>build file:<br><br>    Makefile<br><br>build file templates:<br><br>    ../Configurations/common0.tmpl<br>    ../Configurations/unix-Makefile.tmpl<br>    ../Configurations/common.tmpl<br><br><br>Thanks,<br>Wenbin<br><br></div></div><br><br><span title="neteasefooter"><p> </p></span>