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

patchelf cripples libQt5Core.so #124

Closed
probonopd opened this issue Jun 1, 2017 · 5 comments
Closed

patchelf cripples libQt5Core.so #124

probonopd opened this issue Jun 1, 2017 · 5 comments

Comments

@probonopd
Copy link

probonopd commented Jun 1, 2017

patchelf (e.g., git 44b7f95) cripples (as in: it segfaults) libQt5Core.so coming from https://launchpad.net/~beineri/+archive/ubuntu/opt-qt58-trusty when used on Travis CI, whereas patchelf_0.8-2_amd64.deb does not cripple it.

Working (patched using patchelf_0.8-2_amd64.deb)

ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x93ca0
  Start of program headers:          5373952 (bytes into file)
  Start of section headers:          5353680 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         11
  Size of section headers:           64 (bytes)
  Number of section headers:         34
  Section header string table index: 31

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .note.gnu.build-i NOTE             0000000000000270  00000270
       0000000000000024  0000000000000000   A       0     0     4
  [ 2] .dynsym           DYNSYM           0000000000000298  00000298
       0000000000022ae8  0000000000000018   A      33     1     8
  [ 3] .gnu.hash         GNU_HASH         0000000000057f88  00057f88
       000000000000a818  0000000000000000   A       2     0     8
  [ 4] .gnu.version      VERSYM           00000000000627a0  000627a0
       0000000000002e3e  0000000000000002   A       2     0     2
  [ 5] .gnu.version_d    VERDEF           00000000000655e0  000655e0
       0000000000000198  0000000000000000   A      33    12     4
  [ 6] .gnu.version_r    VERNEED          0000000000065778  00065778
       00000000000001a0  0000000000000000   A      33     8     4
  [ 7] .rela.dyn         RELA             0000000000065918  00065918
       00000000000182b8  0000000000000018   A       2     0     8
  [ 8] .rela.plt         RELA             000000000007dbd0  0007dbd0
       0000000000001968  0000000000000018   A       2    10     8
  [ 9] .init             PROGBITS         000000000007f538  0007f538
       000000000000001a  0000000000000000  AX       0     0     4
  [10] .plt              PROGBITS         000000000007f560  0007f560
       0000000000001100  0000000000000010  AX       0     0     16
  [11] .text             PROGBITS         0000000000080660  00080660
       00000000002d1908  0000000000000000  AX       0     0     16
  [12] .fini             PROGBITS         0000000000351f68  00351f68
       0000000000000009  0000000000000000  AX       0     0     4
  [13] .gcc_except_table PROGBITS         0000000000351f74  00351f74
       0000000000014ce0  0000000000000000   A       0     0     4
  [14] .rodata           PROGBITS         0000000000366c60  00366c60
       0000000000131840  0000000000000000   A       0     0     32
  [15] .interp           PROGBITS         00000000004984a0  004984a0
       000000000000001c  0000000000000000   A       0     0     16
  [16] .eh_frame         PROGBITS         00000000004984c0  004984c0
       0000000000065274  0000000000000000   A       0     0     8
  [17] .eh_frame_hdr     PROGBITS         00000000004fd734  004fd734
       000000000000f7a4  0000000000000000   A       0     0     4
  [18] .tbss             NOBITS           000000000050e600  0050d600
       0000000000000018  0000000000000000 WAT       0     0     16
  [19] .data.rel.ro.loca PROGBITS         000000000050e600  0050d600
       0000000000003570  0000000000000000  WA       0     0     32
  [20] .jcr              PROGBITS         0000000000511b70  00510b70
       0000000000000008  0000000000000000  WA       0     0     8
  [21] .fini_array       FINI_ARRAY       0000000000511b78  00510b78
       0000000000000010  0000000000000000  WA       0     0     8
  [22] .init_array       INIT_ARRAY       0000000000511b88  00510b88
       0000000000000020  0000000000000000  WA       0     0     8
  [23] .data.rel.ro      PROGBITS         0000000000511bc0  00510bc0
       0000000000008620  0000000000000000  WA       0     0     32
  [24] .got              PROGBITS         000000000051a490  00519490
       0000000000000b58  0000000000000000  WA       0     0     8
  [25] .got.plt          PROGBITS         000000000051afe8  00519fe8
       0000000000000890  0000000000000000  WA       0     0     8
  [26] .data             PROGBITS         000000000051b880  0051a880
       00000000000006b8  0000000000000000  WA       0     0     32
  [27] .tm_clone_table   PROGBITS         000000000051bf38  0051af38
       0000000000000000  0000000000000000  WA       0     0     8
  [28] .bss              NOBITS           000000000051bf40  0051af38
       0000000000003de8  0000000000000000  WA       0     0     32
  [29] .note.gnu.gold-ve NOTE             0000000000000000  0051af38
       000000000000001c  0000000000000000           0     0     4
  [30] .gnu_debuglink    PROGBITS         0000000000000000  0051af54
       0000000000000018  0000000000000000           0     0     1
  [31] .shstrtab         STRTAB           0000000000000000  0051af6c
       000000000000015e  0000000000000000           0     0     1
  [32] .dynamic          DYNAMIC          0000000000520268  00520268
       00000000000002c0  0000000000000010  WA      33     0     8
  [33] .dynstr           STRTAB           0000000000520528  00520528
       000000000003520e  0000000000000000   A       0     0     8
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000520000 0x0000000000520000 0x0000000000520000
                 0x0000000000000268 0x0000000000000268  R      8
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x000000000050ced8 0x000000000050ced8  R E    1000
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0
  NOTE           0x0000000000000270 0x0000000000000270 0x0000000000000270
                 0x0000000000000024 0x0000000000000024  R      4
  INTERP         0x00000000004984a0 0x00000000004984a0 0x00000000004984a0
                 0x000000000000001c 0x000000000000001c  R      10
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  GNU_EH_FRAME   0x00000000004fd734 0x00000000004fd734 0x00000000004fd734
                 0x000000000000f7a4 0x000000000000f7a4  R      4
  LOAD           0x000000000050d600 0x000000000050e600 0x000000000050e600
                 0x000000000000d938 0x0000000000011728  RW     1000
  TLS            0x000000000050d600 0x000000000050e600 0x000000000050e600
                 0x0000000000000000 0x0000000000000018  R      10
  GNU_RELRO      0x000000000050d600 0x000000000050e600 0x000000000050e600
                 0x000000000000ca00 0x000000000000ca00  RW     20
  LOAD           0x0000000000520000 0x0000000000520000 0x0000000000520000
                 0x0000000000035738 0x0000000000035738  RW     1000
  DYNAMIC        0x0000000000520268 0x0000000000520268 0x0000000000520268
                 0x00000000000002c0 0x00000000000002c0  RW     8

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .note.gnu.build-id .dynsym .gnu.hash .gnu.version .gnu.version_d .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .gcc_except_table .rodata .interp .eh_frame .eh_frame_hdr 
   02     
   03     .note.gnu.build-id 
   04     .interp 
   05     .eh_frame_hdr 
   06     .data.rel.ro.local .jcr .fini_array .init_array .data.rel.ro .got .got.plt .data .bss 
   07     .tbss 
   08     .data.rel.ro.local .jcr .fini_array .init_array .data.rel.ro .got 
   09     .dynamic .dynstr 
   10     .dynamic 

Dynamic section at offset 0x520268 contains 39 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
 0x0000000000000003 (PLTGOT)             0x51afe8
 0x0000000000000002 (PLTRELSZ)           6504 (bytes)
 0x0000000000000017 (JMPREL)             0x7dbd0
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000007 (RELA)               0x65918
 0x0000000000000008 (RELASZ)             99000 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          3196
 0x0000000000000006 (SYMTAB)             0x298
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0x520528
 0x000000000000000a (STRSZ)              217614 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x57f88
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libicui18n.so.52]
 0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so.52]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000000e (SONAME)             Library soname: [libQt5Core.so.5]
 0x000000000000000c (INIT)               0x7f538
 0x000000000000000d (FINI)               0x351f68
 0x000000000000001a (FINI_ARRAY)         0x511b78
 0x000000000000001c (FINI_ARRAYSZ)       16 (bytes)
 0x0000000000000019 (INIT_ARRAY)         0x511b88
 0x000000000000001b (INIT_ARRAYSZ)       32 (bytes)
 0x000000006ffffff0 (VERSYM)             0x627a0
 0x000000006ffffffc (VERDEF)             0x655e0
 0x000000006ffffffd (VERDEFNUM)          12
 0x000000006ffffffe (VERNEED)            0x65778
 0x000000006fffffff (VERNEEDNUM)         8
 0x0000000000000000 (NULL)               0x0

Not working (patched using git 44b7f95)

ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x93ca0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          5353680 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         11
  Size of section headers:           64 (bytes)
  Number of section headers:         34
  Section header string table index: 29

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .gnu.hash         GNU_HASH         0000000000057f88  00057f88
       000000000000a818  0000000000000000   A      32     0     8
  [ 2] .gnu.version      VERSYM           00000000000627a0  000627a0
       0000000000002e3e  0000000000000002   A      32     0     2
  [ 3] .gnu.version_d    VERDEF           00000000000655e0  000655e0
       0000000000000198  0000000000000000   A      31    12     4
  [ 4] .gnu.version_r    VERNEED          0000000000065778  00065778
       00000000000001a0  0000000000000000   A      31     8     4
  [ 5] .rela.dyn         RELA             0000000000065918  00065918
       00000000000182b8  0000000000000018   A      32     0     8
  [ 6] .rela.plt         RELA             000000000007dbd0  0007dbd0
       0000000000001968  0000000000000018   A      32     8     8
  [ 7] .init             PROGBITS         000000000007f538  0007f538
       000000000000001a  0000000000000000  AX       0     0     4
  [ 8] .plt              PROGBITS         000000000007f560  0007f560
       0000000000001100  0000000000000010  AX       0     0     16
  [ 9] .text             PROGBITS         0000000000080660  00080660
       00000000002d1908  0000000000000000  AX       0     0     16
  [10] .fini             PROGBITS         0000000000351f68  00351f68
       0000000000000009  0000000000000000  AX       0     0     4
  [11] .gcc_except_table PROGBITS         0000000000351f74  00351f74
       0000000000014ce0  0000000000000000   A       0     0     4
  [12] .rodata           PROGBITS         0000000000366c60  00366c60
       0000000000131840  0000000000000000   A       0     0     32
  [13] .interp           PROGBITS         00000000004984a0  004984a0
       000000000000001c  0000000000000000   A       0     0     16
  [14] .eh_frame         PROGBITS         00000000004984c0  004984c0
       0000000000065274  0000000000000000   A       0     0     8
  [15] .eh_frame_hdr     PROGBITS         00000000004fd734  004fd734
       000000000000f7a4  0000000000000000   A       0     0     4
  [16] .tbss             NOBITS           000000000050e600  0050d600
       0000000000000018  0000000000000000 WAT       0     0     16
  [17] .data.rel.ro.loca PROGBITS         000000000050e600  0050d600
       0000000000003570  0000000000000000  WA       0     0     32
  [18] .jcr              PROGBITS         0000000000511b70  00510b70
       0000000000000008  0000000000000000  WA       0     0     8
  [19] .fini_array       FINI_ARRAY       0000000000511b78  00510b78
       0000000000000010  0000000000000000  WA       0     0     8
  [20] .init_array       INIT_ARRAY       0000000000511b88  00510b88
       0000000000000020  0000000000000000  WA       0     0     8
  [21] .data.rel.ro      PROGBITS         0000000000511bc0  00510bc0
       0000000000008620  0000000000000000  WA       0     0     32
  [22] .got              PROGBITS         000000000051a490  00519490
       0000000000000b58  0000000000000000  WA       0     0     8
  [23] .got.plt          PROGBITS         000000000051afe8  00519fe8
       0000000000000890  0000000000000000  WA       0     0     8
  [24] .data             PROGBITS         000000000051b880  0051a880
       00000000000006b8  0000000000000000  WA       0     0     32
  [25] .tm_clone_table   PROGBITS         000000000051bf38  0051af38
       0000000000000000  0000000000000000  WA       0     0     8
  [26] .note.gnu.gold-ve NOTE             0000000000000000  0051af38
       000000000000001c  0000000000000000           0     0     4
  [27] .bss              NOBITS           000000000051bf40  0051af38
       0000000000003de8  0000000000000000  WA       0     0     32
  [28] .gnu_debuglink    PROGBITS         0000000000000000  0051af54
       0000000000000018  0000000000000000           0     0     1
  [29] .shstrtab         STRTAB           0000000000000000  0051af6c
       000000000000015e  0000000000000000           0     0     1
  [30] .dynamic          DYNAMIC          000000000051c000  0051c000
       00000000000002c0  0000000000000010  WA      31     0     8
  [31] .dynstr           STRTAB           000000000051c2c0  0051c2c0
       000000000003520e  0000000000000000   A       0     0     8
  [32] .dynsym           DYNSYM           00000000005514d0  005514d0
       0000000000022ae8  0000000000000018   A      31     1     8
  [33] .note.gnu.build-i NOTE             0000000000573fb8  00573fb8
       0000000000000024  0000000000000000   A       0     0     8
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000000040 0x0000000000000040
                 0x0000000000000268 0x0000000000000268  R      8
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x000000000050ced8 0x000000000050ced8  R E    1000
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0
  NOTE           0x0000000000000270 0x0000000000000270 0x0000000000000270
                 0x0000000000000024 0x0000000000000024  R      4
  INTERP         0x00000000004984a0 0x00000000004984a0 0x00000000004984a0
                 0x000000000000001c 0x000000000000001c  R      10
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  GNU_EH_FRAME   0x00000000004fd734 0x00000000004fd734 0x00000000004fd734
                 0x000000000000f7a4 0x000000000000f7a4  R      4
  LOAD           0x000000000050d600 0x000000000050e600 0x000000000050e600
                 0x000000000000d938 0x0000000000011728  RW     1000
  TLS            0x000000000050d600 0x000000000050e600 0x000000000050e600
                 0x0000000000000000 0x0000000000000018  R      10
  GNU_RELRO      0x000000000050d600 0x000000000050e600 0x000000000050e600
                 0x000000000000ca00 0x000000000000ca00  RW     20
  DYNAMIC        0x000000000051c000 0x000000000051c000 0x000000000051c000
                 0x00000000000002c0 0x00000000000002c0  RW     8
  LOAD           0x000000000051c000 0x000000000051c000 0x000000000051c000
                 0x0000000000057fe0 0x0000000000057fe0  RW     1000

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .gnu.hash .gnu.version .gnu.version_d .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .gcc_except_table .rodata .interp .eh_frame .eh_frame_hdr 
   02     
   03     
   04     .interp 
   05     .eh_frame_hdr 
   06     .data.rel.ro.local .jcr .fini_array .init_array .data.rel.ro .got .got.plt .data .bss 
   07     .tbss 
   08     .data.rel.ro.local .jcr .fini_array .init_array .data.rel.ro .got 
   09     .dynamic 
   10     .dynamic .dynstr .dynsym .note.gnu.build-id 

Dynamic section at offset 0x51c000 contains 39 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
 0x0000000000000003 (PLTGOT)             0x51afe8
 0x0000000000000002 (PLTRELSZ)           6504 (bytes)
 0x0000000000000017 (JMPREL)             0x7dbd0
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000007 (RELA)               0x65918
 0x0000000000000008 (RELASZ)             99000 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          3196
 0x0000000000000006 (SYMTAB)             0x5514d0
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0x51c2c0
 0x000000000000000a (STRSZ)              217614 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x57f88
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libicui18n.so.52]
 0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so.52]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000000e (SONAME)             Library soname: [libQt5Core.so.5]
 0x000000000000000c (INIT)               0x7f538
 0x000000000000000d (FINI)               0x351f68
 0x000000000000001a (FINI_ARRAY)         0x511b78
 0x000000000000001c (FINI_ARRAYSZ)       16 (bytes)
 0x0000000000000019 (INIT_ARRAY)         0x511b88
 0x000000000000001b (INIT_ARRAYSZ)       32 (bytes)
 0x000000006ffffff0 (VERSYM)             0x627a0
 0x000000006ffffffc (VERDEF)             0x655e0
 0x000000006ffffffd (VERDEFNUM)          12
 0x000000006ffffffe (VERNEED)            0x65778
 0x000000006fffffff (VERNEEDNUM)         8
 0x0000000000000000 (NULL)               0x0

Example files

example.tar.gz

@ribtoks
Copy link

ribtoks commented Jun 1, 2017

Experiencing same issue with patchelf 0.9 (latest GitHub release) in linuxdeploy

@ribtoks
Copy link

ribtoks commented Jun 2, 2017

Can confirm that if using patchelf 0.9 but from Debian's mirror (with their patches) it works fine. Dynamic vs Static pagesize might be the case but this is just a hypothesis.

@TheAssassin
Copy link

It's a pity I didn't discover this issue here earlier. I can confirm that with patchelf 0.8 built from source from this repository, patchelf works fine, but newer versions cripple Qt libraries. See my analysis here: linuxdeploy/linuxdeploy-plugin-qt#4 (comment).

@probonopd
Copy link
Author

probonopd commented Apr 30, 2019

This is still an issue and can be reproduced.

@domenkozar
Copy link
Member

Resolved with #202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants