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

loader.c uses AT_FLAGS to communicate literally #1168

Closed
wants to merge 5 commits into from

Commits on May 6, 2024

  1. loader.c uses AT_FLAGS to communicate literally

    Now the `ape - prog args...` form communicates to the loaded binary that
    argv[0] is preserved. This is done via either editing the previous flags
    passed in auxv, or adding a new AT_FLAGS value at the end if one was not
    found.
    
    I decided to always insert an AT_FLAGS entry, although another option is
    to only insert one if literally is true. This would change the value for
    `n` to `... + 2 * (!flags && literally) + ...` and add another branch to
    the if statement. I guessed that the extra branch was not worth saving 2
    words on the stack sometimes.
    mrdomino committed May 6, 2024
    Configuration menu
    Copy the full SHA
    b77a3d5 View commit details
    Browse the repository at this point in the history
  2. Add TODO in test

    We should be measuring the AT_FLAGS of the child process, since it may
    be true even if it is false for the parent process.
    mrdomino committed May 6, 2024
    Configuration menu
    Copy the full SHA
    f6cc903 View commit details
    Browse the repository at this point in the history
  3. Zero out end-of-auxv

    I haven’t actually thought extremely carefully about exactly which value
    gets zeroed by the previously-mentioned loop, but it varies by one word,
    so it’s wrong half the time.
    mrdomino committed May 6, 2024
    Configuration menu
    Copy the full SHA
    d259b4a View commit details
    Browse the repository at this point in the history
  4. Set flags correctly

    mrdomino committed May 6, 2024
    Configuration menu
    Copy the full SHA
    7aef5c7 View commit details
    Browse the repository at this point in the history
  5. Only take the first flags

    mrdomino committed May 6, 2024
    Configuration menu
    Copy the full SHA
    e788df7 View commit details
    Browse the repository at this point in the history