public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/23293] aarch64: getauxval is broken when run as ld.so ./exe and ld.so adjusts argv on the stack
Date: Thu, 25 Jun 2020 15:39:46 +0000	[thread overview]
Message-ID: <bug-23293-131-WjWL0z5WXc@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-23293-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=23293

--- Comment #5 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Szabolcs Nagy from comment #4)
> (In reply to Florian Weimer from comment #3)
> > (In reply to Michael Hudson-Doyle from comment #2)
> > > I've just run into this because it causes a glibc test failure when
> > > libnss-systemd is enabled
> > > (https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1869364).
> > > 
> > > Would a fix be for _dl_start_user to update _dl_auxv in the same way it
> > > updates _dl_argv? Or is that just naive (start up code confuses me!)
> > 
> > I think this should work. There does not seems to be anything that stores
> > the address if auxv entries, only values read from the vector.
> 
> it may work, but i think _dl_start_user stack handling should
> not be updated, it should be removed: the logic is backwards:
> 
> most targets have fragile asm for the rtld start code to shuffle
> around entries on the stack, but such shuffling can be done in c
> in the generic code (e.g. in dl_main).
> 
> this would also fix the (imo security) bug that the protection
> of dl data is not consistent across targets (DL_ARGV_NOT_RELRO).
> 
> and all this mess is for saving a few cycles on targets where
> you don't need to do the shuffling. i think the generic code
> should work for all targets and those who wish to optimize
> add some hacks (e.g. ifdef out the shuffling), not the other
> way around.
> 
> i didnt get the chance to clean this up yet, so it's not fixed.

That sounds of course very reasonable. As long as very manipulate the arguments
as arrays, the C code should be very portable. An assembler stub will still be
needed, but it will be much smaller.

I also think we should move the assembler code out of dl-machine.h while we are
at it. We can start out with an empty dl-start.S file, and gradually move ports
to follow the powerpc32 example.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-06-25 15:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-23293-131@http.sourceware.org/bugzilla/>
2020-06-24 21:01 ` michael.hudson at canonical dot com
2020-06-24 21:16 ` michael.hudson at canonical dot com
2020-06-25  8:52 ` fweimer at redhat dot com
2020-06-25 15:34 ` nsz at gcc dot gnu.org
2020-06-25 15:39 ` fweimer at redhat dot com [this message]
2022-03-10 13:48 ` kdudka at redhat dot com
2022-05-03  8:33 ` fweimer at redhat dot com
2022-05-17  9:19 ` cvs-commit at gcc dot gnu.org
2022-05-17  9:19 ` cvs-commit at gcc dot gnu.org
2022-05-17 12:28 ` nsz at gcc dot gnu.org
2022-05-19  9:52 ` cvs-commit at gcc dot gnu.org
2022-05-19  9:52 ` cvs-commit at gcc dot gnu.org
2022-05-19 15:49 ` cvs-commit at gcc dot gnu.org
2022-05-19 15:49 ` cvs-commit at gcc dot gnu.org
2022-06-09 11:34 ` sam at gentoo dot org
2022-06-10  0:07 ` sam at gentoo dot org

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=bug-23293-131-WjWL0z5WXc@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).