Skip to content

Conversation

@rjzak
Copy link
Member

@rjzak rjzak commented Mar 9, 2024

This is preferred as crt0stack::Reader::from_environ() relies on the global environ pointer and:

  1. The environ pointer is not guaranteed to point to memory before auxv by any standard I am aware of. It just happens to do so in some C library implementations if the environment has not been modified.
  2. The environ pointer is definitely not going to point to memory before auxv after calling any environment modifying function such as setenv(3).

Calling getauxval(3) is the only standards compliant way of accessing values in the auxiliary vector.

Dup of #20 since it has conflicts and tests weren't running.

@rjzak rjzak requested a review from a team as a code owner March 9, 2024 17:57
@rjzak rjzak requested review from bstrie and removed request for a team March 9, 2024 17:57
This is preferred as crt0stack::Reader::from_environ() relies on the
global environ pointer and:
1. The environ pointer is not guaranteed to point to memory before auxv
   by any standard I am aware of. It just happens to do so in some C
   library implementations if the environment has not been modified.
2. The environ pointer is definitely not going to point to memory before
   auxv after calling any environment modifying function such as
   setenv(3).

Calling getauxval(3) is the only standards compliant way of accessing
values in the auxiliary vector.

Co-authored-by: Patrick Oppenlander <[email protected]>
Signed-off-by: Richard Zak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: For Review

Development

Successfully merging this pull request may close these issues.

1 participant