Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locate VDSO by calling libc::getauxval #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

pattop
Copy link

@pattop pattop commented Nov 23, 2023

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.

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.

Signed-off-by: Patrick Oppenlander <[email protected]>
@pattop pattop requested a review from a team as a code owner November 23, 2023 00:56
@pattop pattop requested review from rjzak and removed request for a team November 23, 2023 00:56
@rjzak rjzak mentioned this pull request Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant