qemu-e2k/linux-user
Peter Maydell 82991bed73 linux-user: Put PPC AT_IGNOREPPC auxv entries in the right place
The 32-bit PPC auxv is a bit complicated because in the
mists of time it used to be 16-aligned rather than directly
after the environment. Older glibc versions had code to
try to probe for whether it needed alignment or not:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c;hb=e84eabb3871c9b39e59323bf3f6b98c2ca9d1cd0
and the kernel has code which puts some magic entries at
the bottom to ensure that the alignment probe fails:
http://elixir.free-electrons.com/linux/latest/source/arch/powerpc/include/asm/elf.h#L158

QEMU has similar code too, but it was broken by commit
7c4ee5bcc8, which changed elfload.c from filling in
the auxv starting at the highest address and working down
to starting at the lowest address and working up. This
means that the ARCH_DLINFO hook must now be invoked first
rather than last, and the entries in it for PPC must
be reversed so that the magic AT_IGNOREPPC entries come
at the lowest address in the auxv as they should.

The effect of this was that if running a guest binary that
used an old glibc with the alignment probing the guest ld.so
code would segfault if the size of the guest environment and
argv happened to put the auxv at an address that triggered
the alignment code in the guest glibc.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: Richard Henderson <rth@twiddle.net>
Message-id: 1498582198-6649-1-git-send-email-peter.maydell@linaro.org
2017-06-29 10:25:26 +01:00
..
aarch64
alpha
arm
cris
host
hppa
i386
m68k
microblaze
mips
mips64
nios2
openrisc target/openrisc: implement shadow registers 2017-05-04 09:39:01 +09:00
ppc
s390x
sh4
sparc
sparc64
tilegx
unicore32
x86_64
elfload.c linux-user: Put PPC AT_IGNOREPPC auxv entries in the right place 2017-06-29 10:25:26 +01:00
errno_defs.h
flat.h
flatload.c
ioctls.h linux-user: Add FICLONE and FICLONERANGE ioctls 2017-02-16 15:29:30 +01:00
linux_loop.h
linuxload.c
m68k-sim.c
main.c trivial patches for 2017-05-10 2017-05-10 12:31:19 -04:00
Makefile.objs
mmap.c linux-user: fix tcg/mmap test 2017-02-16 15:29:30 +01:00
qemu.h
safe-syscall.S
signal.c target/openrisc: implement shadow registers 2017-05-04 09:39:01 +09:00
socket.h
strace.c linux-user: add strace support for uinfo structure of rt_sigqueueinfo() and rt_tgsigqueueinfo() 2017-05-29 14:56:09 +03:00
strace.list linux-user: add rt_tgsigqueueinfo() strace 2017-05-29 14:56:08 +03:00
syscall_defs.h linux-user: Add sockopts for IPv6 ping and IPv6 traceroute 2017-02-27 23:10:02 +01:00
syscall_types.h linux-user: Add FICLONE and FICLONERANGE ioctls 2017-02-16 15:29:30 +01:00
syscall.c linux-user: add support for rt_tgsigqueueinfo() system call 2017-05-29 14:56:08 +03:00
target_flat.h
trace-events
uaccess.c
uname.c
uname.h
vm86.c