Date: Mon, 27 Jun 2016 17:58:12 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: request for help with aux 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.