[openssl-dev] [openssl.org #4286] Debug in OpenSSL

Tiantian Liu via RT rt at openssl.org
Tue Feb 2 15:52:06 UTC 2016


Hi Kurt,

Thanks for your response!

I tried the command, now I give you the result:

1. #readelf -S /usr/lib/libcryptio.so.1.0.0

There are 37 section headers, starting at offset 0x5081d0:



Section Headers:

  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al

  [ 0]                   NULL            00000000 000000 000000 00      0   0  0

  [ 1] .gnu.hash         GNU_HASH        000000d4 0000d4 006ee4 04   A  2   0  4

  [ 2] .dynsym           DYNSYM          00006fb8 006fb8 010230 10   A  3   1  4

  [ 3] .dynstr           STRTAB          000171e8 0171e8 012dd2 00   A  0   0  1

  [ 4] .gnu.version      VERSYM          00029fba 029fba 002046 02   A  2   0  2

  [ 5] .gnu.version_r    VERNEED         0002c000 02c000 0000b0 00   A  3   3  4

  [ 6] .rel.dyn          REL             0002c0b0 02c0b0 0104a0 08   A  2   0  4

  [ 7] .rel.plt          REL             0003c550 03c550 000320 08   A  2   9  4

  [ 8] .init             PROGBITS        0003c870 03c870 00001c 00  AX  0   0  4

  [ 9] .plt              PROGBITS        0003c88c 03c88c 000650 04  AX  0   0  4

  [10] .text             PROGBITS        0003cf00 03cf00 10d804 00  AX  0   0 64

  [11] .fini             PROGBITS        0014a704 14a704 00001c 00  AX  0   0  4

  [12] .rodata           PROGBITS        0014a720 14a720 0282e1 00   A  0   0 32

  [13] .eh_frame_hdr     PROGBITS        00172a04 172a04 00001c 00   A  0   0  4

  [14] .eh_frame         PROGBITS        00172a20 172a20 00005c 00   A  0   0  4

  [15] .ctors            PROGBITS        00173a7c 172a7c 000008 00  WA  0   0  4

  [16] .dtors            PROGBITS        00173a84 172a84 000008 00  WA  0   0  4

  [17] .jcr              PROGBITS        00173a8c 172a8c 000004 00  WA  0   0  4

  [18] .data.rel.ro      PROGBITS        00173aa0 172aa0 00e8e8 00  WA  0   0 32

  [19] .dynamic          DYNAMIC         00182388 181388 0000e8 08  WA  3   0  4

  [20] .got              PROGBITS        00182470 181470 000500 04  WA  0   0  4

  [21] .got.plt          PROGBITS        00182970 181970 00019c 04  WA  0   0  4

  [22] .data             PROGBITS        00182b20 181b20 0061fc 00  WA  0   0 32

  [23] .bss              NOBITS          00188d20 187d1c 003234 00  WA  0   0 32

  [24] .comment          PROGBITS        00000000 187d1c 006838 00      0   0  1

  [25] .debug_aranges    PROGBITS        00000000 18e558 004868 00      0   0  8

  [26] .debug_pubnames   PROGBITS        00000000 192dc0 018c23 00      0   0  1

  [27] .debug_info       PROGBITS        00000000 1ab9e3 28dcb1 00      0   0  1

  [28] .debug_abbrev     PROGBITS        00000000 439694 02f509 00      0   0  1

  [29] .debug_line       PROGBITS        00000000 468b9d 034b00 00      0   0  1

  [30] .debug_frame      PROGBITS        00000000 49d6a0 02be04 00      0   0  4

  [31] .debug_str        PROGBITS        00000000 4c94a4 009f7b 00      0   0  1

  [32] .debug_loc        PROGBITS        00000000 4d341f 034c40 00      0   0  1

  [33] .debug_ranges     PROGBITS        00000000 50805f 000018 00      0   0  1

  [34] .shstrtab         STRTAB          00000000 508077 000156 00      0   0  1

  [35] .symtab           SYMTAB          00000000 508798 01dd00 10     36 3502  4

  [36] .strtab           STRTAB          00000000 526498 01dd95 00      0   0  1

Key to Flags:

  W (write), A (alloc), X (execute), M (merge), S (strings)

  I (info), L (link order), G (group), x (unknown)

  O (extra OS processing required) o (OS specific), p (processor specific)



I also tried another command as

2. #readelf --debug-dump /usr/lib/libcryptio.so.1.0.0

    13519               pem_check_suffix

    13707               PEM_version

  Length:                              1698

  Version:                             2

  Offset into .debug_info section:     1475134

  Size of area in .debug_info section: 17241



    Offset      Name

    10875               PEM_read_bio_X509_REQ

    10991               PEM_read_X509_REQ

    11091               PEM_write_bio_X509_REQ

    11165               PEM_write_X509_REQ

    11235               PEM_write_bio_X509_REQ_NEW

    11313               PEM_write_X509_REQ_NEW

    11387               PEM_read_bio_X509_CRL

    11485               PEM_read_X509_CRL

    11579               PEM_write_bio_X509_CRL

    11653               PEM_write_X509_CRL

    11723               PEM_read_bio_PKCS7

    11830               PEM_read_PKCS7

    11921               PEM_write_bio_PKCS7

    11992               PEM_write_PKCS7

    12059               PEM_read_bio_NETSCAPE_CERT_SEQUENCE

    12183               PEM_read_NETSCAPE_CERT_SEQUENCE

    12291               PEM_write_bio_NETSCAPE_CERT_SEQUENCE

    12379               PEM_write_NETSCAPE_CERT_SEQUENCE

    12550               PEM_read_bio_RSAPrivateKey

    12669               PEM_read_RSAPrivateKey

    12784               PEM_write_bio_RSAPrivateKey

    12930               PEM_write_RSAPrivateKey

    13072               PEM_read_bio_RSAPublicKey

    13174               PEM_read_RSAPublicKey

    13272               PEM_write_bio_RSAPublicKey

    13350               PEM_write_RSAPublicKey

    13424               PEM_read_bio_RSA_PUBKEY

    13524               PEM_read_RSA_PUBKEY

    13620               PEM_write_bio_RSA_PUBKEY

    13696               PEM_write_RSA_PUBKEY

    13855               PEM_read_bio_DSAPrivateKey

    13980               PEM_write_bio_DSAPrivateKey

    14134               PEM_write_DSAPrivateKey

    14284               PEM_read_bio_DSA_PUBKEY

    14389               PEM_read_DSA_PUBKEY

    14490               PEM_write_bio_DSA_PUBKEY

    14569               PEM_write_DSA_PUBKEY

I can see the debug symbols PEM_write_RSAPrivateKey, but why I can't step into that function?



And I also used ldd command and confirmed that my application does reference the /usr/lib/libcryptio.so.1.0.0

[root at lin5ent Multi]# ldd myApp_serv4

        linux-gate.so.1 =>  (0x00882000)

        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00552000)

        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x0064c000)

        libptcoresdk.so.2 => /usr/lib/libptcoresdk.so.2 (0x00110000)

        libcom_err.so.2 => /lib/libcom_err.so.2 (0x0070a000)

        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00885000)

        libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x0071b000)

        libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00ceb000)

        libdl.so.2 => /lib/libdl.so.2 (0x00ba4000)

        libpthread.so.0 => /lib/i686/nosegneg/libpthread.so.0 (0x00baa000)

        libc.so.6 => /lib/i686/nosegneg/libc.so.6 (0x00a39000)

        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x0083f000)

        libresolv.so.2 => /lib/libresolv.so.2 (0x0053d000)

        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00859000)

        libm.so.6 => /lib/i686/nosegneg/libm.so.6 (0x00b7b000)

        /lib/ld-linux.so.2 (0x00a1c000)



Please help me.



Thanks,

Tyler



-----Original Message-----
From: Kurt Roeckx via RT [mailto:rt at openssl.org]
Sent: February-01-16 6:31 PM
To: Tiantian (Tyler) Liu
Cc: openssl-dev at openssl.org
Subject: Re: [openssl-dev] [openssl.org #4286] Debug in OpenSSL



On Mon, Feb 01, 2016 at 10:21:30PM +0000, Tiantian Liu via RT wrote:

> Hi, ALL,

>

> I am software developer who is struggling with encryption and decryption issues in my application.

>

> Our customer complained our application crashed at the point where OpenSSL method,  PEM_read_RSAPrivateKey, being called.

>

> While I can't duplicate the crash in my machine. So I want to enable debug in OpenSSL and core dumping on their machine, then I can get the core dump file upon the crash on customer's side. And I can use GDB to debug the core dump to see what happened in side the so-called PEM_read_RSAPrivateKey.

>

> Today, I re-compiled my OpenSSL (version openssl-1.0.1p). However, when I set the breakpoint at PEM_read_RSAPrivateKey, my GDB can't step into that function, just bypassed directly.

> My machine is 32-bit RedHat Enterprise 5. What I did in configure and installation:

>

> #./Configure -g debug-linux-elf -prefix=/usr shared # make # make

> install



Are you sure it doesn't get stripped at some point?  Can you check that the files actually contain debug info?  Try:

readelf -S /usr/lib/libcrypto.so.1.0.0





Kurt









More information about the openssl-dev mailing list