From: Richard Henderson <rth@twiddle.net>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: patches@linaro.org, Laurent Vivier <laurent@vivier.eu>,
Riku Voipio <riku.voipio@iki.fi>
Subject: Re: [Qemu-devel] [PATCH] linux-user: Put PPC AT_IGNOREPPC auxv entries in the right place
Date: Tue, 27 Jun 2017 11:05:20 -0700 [thread overview]
Message-ID: <b17a6dac-f3b8-b874-f64c-77e4279923eb@twiddle.net> (raw)
In-Reply-To: <1498582198-6649-1-git-send-email-peter.maydell@linaro.org>
On 06/27/2017 09:49 AM, Peter Maydell wrote:
> 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
> 7c4ee5bcc82e64, 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>
> ---
> linux-user/elfload.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: Richard Henderson <rth@twiddle.net>
r~
next prev parent reply other threads:[~2017-06-27 18:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-27 16:49 [Qemu-devel] [PATCH] linux-user: Put PPC AT_IGNOREPPC auxv entries in the right place Peter Maydell
2017-06-27 18:05 ` Richard Henderson [this message]
2017-06-29 10:44 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b17a6dac-f3b8-b874-f64c-77e4279923eb@twiddle.net \
--to=rth@twiddle.net \
--cc=laurent@vivier.eu \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).