From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: request for help with aux
Date: Mon, 27 Jun 2016 17:58:12 -0400 [thread overview]
Message-ID: <20160627215812.GJ10893@brightrain.aerifal.cx> (raw)
In-Reply-To: <CALzRTRnENpgnCRdJBfOb2CwAD-h6EE_mxgSXPi0abnWuNZsbaQ@mail.gmail.com>
On Mon, Jun 27, 2016 at 01:07:59PM -0700, Daniel Wilkerson wrote:
> The musl crt0 code seems to expect that when the process starts that
> the stack pointer points to a data page having the following four data
> structures immediately contiguous: argc, argv, env, aux.
It's not necessarily a page. It's just an array of sorts that's
aligned to the (pointer) wordsize.
> I'm writing a loader for musl-riscv and I need to know how to
> initialize this data. The only one I wonder about is the aux array.
> It seems that aux is a collection of name/value pairs which are used
> as follows in musl-riscv/src/env/__libc_start_main.c:
There are various places it's used; try something like:
grep -r aux.*AT_ src ldso
For static linking only, at least AT_PHDR/AT_PHENT/AT_PHNUM need to be
correct in order for the executable's TLS image to be located at
runtime. AT_RANDOM should be valid (and point to a buffer of at least
16 random bytes IIRC) in order for stack protector to work correctly.
Other fields that are used if present but probably don't matter for
bare-metal setups you're looking at are AT_HWCAP, AT_SYSINFO_EHDR, and
AT_SECURE and the related uid/gid fields.
Rich
next prev parent reply other threads:[~2016-06-27 21:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 20:07 Daniel Wilkerson
2016-06-27 21:00 ` Bobby Bingham
2016-06-27 21:33 ` Daniel Wilkerson
2016-06-27 21:49 ` Nathan McSween
2016-06-27 21:58 ` Rich Felker [this message]
2016-06-28 0:22 ` Patrick Oppenlander
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=20160627215812.GJ10893@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).