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

Can't open some ELF files (numpy binaries for examples) #106

Closed
diorcety opened this issue Oct 1, 2018 · 4 comments
Closed

Can't open some ELF files (numpy binaries for examples) #106

diorcety opened this issue Oct 1, 2018 · 4 comments
Labels

Comments

@diorcety
Copy link

diorcety commented Oct 1, 2018

cd /tmp
mkdir numpy
wget https://files.pythonhosted.org/packages/40/c5/f1ed15dd931d6667b40f1ab1c2fe1f26805fc2b6c3e25e45664f838de9d0/numpy-1.15.2-cp27-cp27mu-manylinux1_x86_64.whl
unzip numpy-1.15.2-cp27-cp27mu-manylinux1_x86_64.whl
rdr /tmp/numpy/./numpy/core/multiarray.so
Malformed entity: Strtable size (9556) + offset (4280848) is out of bounds for 2070376 #bytes. Overflowed: false
@philipc
Copy link
Collaborator

philipc commented Oct 2, 2018

This is because the bias calculation only uses the first PT_LOAD segment, but for this binary the dynamic strtab is in a later segment with a different bias:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [27] .dynstr           STRTAB           0000000000415210  001f7210
       0000000000002554  0000000000000000   A       0     0     8

Dynamic section at offset 0x1f7000 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000005 (STRTAB)             0x415210
 0x000000000000000a (STRSZ)              9556 (bytes)

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x00000000001d905c 0x00000000001d905c  R E    0x200000
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
  NOTE           0x00000000000001c8 0x00000000000001c8 0x00000000000001c8
                 0x0000000000000024 0x0000000000000024  R      0x4
  GNU_EH_FRAME   0x00000000001a0fa4 0x00000000001a0fa4 0x00000000001a0fa4
                 0x0000000000008a94 0x0000000000008a94  R      0x4
  LOAD           0x00000000001d9060 0x00000000003d9060 0x00000000003d9060
                 0x0000000000018e60 0x0000000000037808  RW     0x200000
  TLS            0x00000000001d9060 0x00000000003d9060 0x00000000003d9060
                 0x0000000000000000 0x00000000000000d4  R      0x10
  LOAD           0x00000000001f3000 0x0000000000411000 0x0000000000411000
                 0x0000000000003010 0x0000000000003010  RW     0x1000
  DYNAMIC        0x00000000001f7000 0x0000000000415000 0x0000000000415000
                 0x0000000000000210 0x0000000000000210  RW     0x8
  LOAD           0x00000000001f7000 0x0000000000415000 0x0000000000415000
                 0x0000000000002768 0x0000000000002768  RW     0x1000

I haven't read the code enough to know if we can fix this easily. Probably we need to find the corresponding segment for each individual address, instead of using the same bias for everything. Thoughts @m4b?

@diorcety
Copy link
Author

Is there any news about this issue?

@m4b
Copy link
Owner

m4b commented May 27, 2019

Pretty sure @philipc fixed this; running repro from above on master has no issue; going to close, I'll publish a new version

@m4b
Copy link
Owner

m4b commented May 27, 2019

Please reopen if you find similar issue :)

@m4b m4b closed this as completed May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants