Package: libc6
Version: 2.18-7
Severity: normal
File: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2

Hi,

I want to mmap a large file to 0x10000 because the data contains
pointers and was originally at that offset. Mapping somewhere else and
relocating all the pointers is impossible. Unfortunately on amd64
binaries are normaly mapped at 0x00400000 and 0x0060a000 onwards,
conflicting with mapping the file. So I tried to link my binary to be
at a different address. But that makes ld.so crash with SIGSEGV or
SIGILL.

----------------------------------------------------------------------
echo 'int main() { return 0; }' | gcc-4.8 
-Wl,--section-start=.interp=0x70000000 -x c -
gdb ./a.out

Program received signal SIGSEGV, Segmentation fault.
dl_main (phdr=phdr@entry=0x6fe00040, phnum=phnum@entry=8, 
    user_entry=user_entry@entry=0x7fffffffe3c8, auxv=<optimized out>)
    at rtld.c:1169
1169    rtld.c: No such file or directory.
(gdb) bt
#0  dl_main (phdr=phdr@entry=0x6fe00040, phnum=phnum@entry=8, 
    user_entry=user_entry@entry=0x7fffffffe3c8, auxv=<optimized out>)
    at rtld.c:1169
#1  0x00007ffff7df2215 in _dl_sysdep_start (
    start_argptr=start_argptr@entry=0x7fffffffe480, 
    dl_main=dl_main@entry=0x7ffff7dde670 <dl_main>) at ../elf/dl-sysdep.c:249
#2  0x00007ffff7de19f6 in _dl_start_final (arg=0x7fffffffe480) at rtld.c:332
#3  _dl_start (arg=0x7fffffffe480) at rtld.c:558
#4  0x00007ffff7dde188 in _start () from /lib64/ld-linux-x86-64.so.2
#5  0x0000000000000001 in ?? ()
#6  0x00007fffffffe6fd in ?? ()
#7  0x0000000000000000 in ?? ()
----------------------------------------------------------------------
echo 'int main() { return 0; }' | gcc-4.8 -Wl,--section-start=.interp=0x40000 
-x c -
gdb ./a.out 

During startup program terminated with signal SIGKILL, Killed.
(gdb) bt
No stack.
----------------------------------------------------------------------
Surprisingly the following works again:

echo 'int main() { return 0; }' | gcc-4.8 
-Wl,--section-start=.interp=0x70000200 -x c -

The difference seems to be where the section headers are placed in the
output file.

Working:   Start of section headers:          2528 (bytes into file)
Crashing:  Start of section headers:          2099168 (bytes into file)

MfG
        Goswin

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc6:amd64 depends on:
ii  libgcc1  1:4.9.0-1

libc6:amd64 recommends no packages.

Versions of packages libc6:amd64 suggests:
ii  debconf [debconf-2.0]  1.5.53
pn  glibc-doc              <none>
ii  locales                2.18-5

-- debconf information excluded


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to