Menu

Segmentation fault on 64-bit system

Help
2016-08-15
2016-09-18
  • Sod Almighty

    Sod Almighty - 2016-08-15

    When I run statifier on a 32-bit executable it produces an executable that will run on a 32-bit system. However, the resultant executable segfaults when run on a 64-bit machine. Also, if I run statifier on a 64-bit version of the executable, the resulting executable segfaults when run.

     
  • Valery Reznic

    Valery Reznic - 2016-08-17

    Could you please provide a bit more info:
    what is your 32-bit system (distribution, version, kernel version) where statified exe works
    what is your 64-bit system (distribution, version, kernel version) where statified exe fails

    Output of
    cat /proc/self/maps

    twice for each system

     
  • Sod Almighty

    Sod Almighty - 2016-08-19

    Well, I'm not sure what's changed, but now it doesn't work at all, even on the 32-bit system.

    32-bit system: Debian 7.9 3.2.0-4-686-pae #1 SMP Debian 3.2.68-1+deb7u3 i686 GNU/Linux
    64-bit system: Debian 8.2 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux

    # csc linux-setup.scm     ; compile Scheme code
    # ./linux-setup           ; run compiled (dynamic) exe - it works
    # ldd ./linux-setup
            linux-gate.so.1 =>  (0xb776e000)
            libchicken.so.6 => /usr/lib/libchicken.so.6 (0xb73dd000)
            libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xb73a7000)
            libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb73a2000)
            libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb723e000)
            /lib/ld-linux.so.2 (0xb776f000)
    # statifier ./linux-setup ./linux-setup-static
    # ./linux-setup-static
    zsh: segmentation fault  ./linux-setup-static
    

    As I said, four days ago the process would work on the 32-bit system, but not on my 64-bit system. Now, for some reason, it won't work on either system. I don't recall changing the code in the meanwhile.

    32-bit system:

    # cat /proc/self/maps
    08048000-08054000 r-xp 00000000 08:01 1835022    /bin/cat
    08054000-08055000 r--p 0000b000 08:01 1835022    /bin/cat
    08055000-08056000 rw-p 0000c000 08:01 1835022    /bin/cat
    09fec000-0a00d000 rw-p 00000000 00:00 0          [heap]
    b74b0000-b7627000 r--p 00000000 08:01 1319664    /usr/lib/locale/locale-archive
    b7627000-b7628000 rw-p 00000000 00:00 0
    b7628000-b7786000 r-xp 00000000 08:01 1703989    /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
    b7786000-b7788000 r--p 0015e000 08:01 1703989    /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
    b7788000-b7789000 rw-p 00160000 08:01 1703989    /lib/i386-linux-gnu/i686/cmov/libc-2.13.so
    b7789000-b778c000 rw-p 00000000 00:00 0
    b779c000-b779e000 rw-p 00000000 00:00 0
    b779e000-b779f000 r-xp 00000000 00:00 0          [vdso]
    b779f000-b77bb000 r-xp 00000000 08:01 1704025    /lib/i386-linux-gnu/ld-2.13.so
    b77bb000-b77bc000 r--p 0001b000 08:01 1704025    /lib/i386-linux-gnu/ld-2.13.so
    b77bc000-b77bd000 rw-p 0001c000 08:01 1704025    /lib/i386-linux-gnu/ld-2.13.so
    bfab4000-bfad5000 rw-p 00000000 00:00 0          [stack]
    

    64-bit system:

    # cat /proc/self/maps
    00400000-0040c000 r-xp 00000000 08:51 1048590                            /bin/cat
    0060b000-0060c000 r--p 0000b000 08:51 1048590                            /bin/cat
    0060c000-0060d000 rw-p 0000c000 08:51 1048590                            /bin/cat
    00da3000-00dc4000 rw-p 00000000 00:00 0                                  [heap]
    7f525c613000-7f525c7b5000 r-xp 00000000 08:51 805946                     /lib/x86_64-linux-gnu/libc-2.19.so
    7f525c7b5000-7f525c9b4000 ---p 001a2000 08:51 805946                     /lib/x86_64-linux-gnu/libc-2.19.so
    7f525c9b4000-7f525c9b8000 r--p 001a1000 08:51 805946                     /lib/x86_64-linux-gnu/libc-2.19.so
    7f525c9b8000-7f525c9ba000 rw-p 001a5000 08:51 805946                     /lib/x86_64-linux-gnu/libc-2.19.so
    7f525c9ba000-7f525c9be000 rw-p 00000000 00:00 0
    7f525c9be000-7f525c9de000 r-xp 00000000 08:51 805935                     /lib/x86_64-linux-gnu/ld-2.19.so
    7f525ca12000-7f525ca34000 rw-p 00000000 00:00 0
    7f525ca34000-7f525cbbd000 r--p 00000000 08:51 150359                     /usr/lib/locale/locale-archive
    7f525cbbd000-7f525cbc0000 rw-p 00000000 00:00 0
    7f525cbdc000-7f525cbde000 rw-p 00000000 00:00 0
    7f525cbde000-7f525cbdf000 r--p 00020000 08:51 805935                     /lib/x86_64-linux-gnu/ld-2.19.so
    7f525cbdf000-7f525cbe0000 rw-p 00021000 08:51 805935                     /lib/x86_64-linux-gnu/ld-2.19.so
    7f525cbe0000-7f525cbe1000 rw-p 00000000 00:00 0
    7ffff5b08000-7ffff5b29000 rw-p 00000000 00:00 0                          [stack]
    7ffff5b3b000-7ffff5b3d000 r-xp 00000000 00:00 0                          [vdso]
    7ffff5b3d000-7ffff5b3f000 r--p 00000000 00:00 0                          [vvar]
    ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
    
     

    Last edit: Sod Almighty 2016-08-19
  • Sod Almighty

    Sod Almighty - 2016-08-19

    Incidentally:

    # LD_ASSUME_KERNEL=2.2.5 statifier ./linux-setup ./linux-setup-static
    /bin/sh: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
    # LD_ASSUME_KERNEL=3.2.0.4 statifier ./linux-setup ./linux-setup-static
    # ./linux-setup-static
    zsh: segmentation fault  ./linux-setup-static
    

    Sigh :(

     
  • Alexey Kulentsov

    Segmentation fault on any D-generated 64 bit executable. Minimal example attached. If you want to compile example itself you need DMD and dub (both exists in Ubuntu software repos).
    Ubuntu 16.04 64 bit

     
    • Valery Reznic

      Valery Reznic - 2016-09-18

      Unfortunately, statifiied program segfault on the systems with memory randomization.
      You can try to turn memory randomization off, statify your executable and then try to run it.
      Valery

        From: Alexey Kulentsov <crimaniak@users.sf.net>
      

      To: [statifier:discussion] 358807@discussion.statifier.p.re.sf.net
      Sent: Wednesday, September 14, 2016 10:10 PM
      Subject: [statifier:discussion] Segmentation fault on 64-bit system

      Segmentation fault on any D-generated 64 bit executable. Minimal example attached. If you want to compile example itself you need DMD and dub (both exists in Ubuntu software repos).
      Ubuntu 16.04 64 bitAttachments:

       

Log in to post a comment.

MongoDB Logo MongoDB