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

Switch from .init_array constructors to /proc/self/auxv. #385

Merged
merged 9 commits into from Aug 8, 2022

Commits on Jul 26, 2022

  1. Switch from .init_array constructors to /proc/self/auxv.

    In the linux_raw backend, switch from using a `.init_array` constructor
    for obtaining the aux values to reading them from /proc/self/auxv. This avoids
    problems in situation where other Rust code can run before the constructor,
    potentially distrupting the `__environ` value.
    
    Also, for the linux_raw backend, introduce a new "use-libc-auxv" feature,
    which enables use of libc to read the aux values, instead of reading
    them from /proc/self/auxv.
    
    The "use-libc-auxv" option is enabled by default, because it's more
    efficient and doesn't depend on /proc, so it's likely better for most
    users.
    
    Mustang, for its part, continues to be able to use the incoming auxv on
    the stack because it controls program startup. Since it doesn't have to
    worry about the hazards of /proc or QEMU, it can trust the incoming
    values, and do less checking.
    
    Fixes #382.
    sunfishcode committed Jul 26, 2022
    Copy the full SHA
    3357f57 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    ffacfac View commit details
    Browse the repository at this point in the history
  3. Fix the no-std build.

    sunfishcode committed Jul 26, 2022
    Copy the full SHA
    7cbebb8 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    fabb6d4 View commit details
    Browse the repository at this point in the history
  5. Use NonNull in check_raw_pointer's return type.

    This allows it to pack the return value into a single pointer-sized
    value.
    sunfishcode committed Jul 26, 2022
    Copy the full SHA
    e019fbb View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    bb5c213 View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    054145f View commit details
    Browse the repository at this point in the history
  8. Fix copy+paste.

    sunfishcode committed Jul 26, 2022
    Copy the full SHA
    cd08068 View commit details
    Browse the repository at this point in the history
  9. Copy the full SHA
    6b8a217 View commit details
    Browse the repository at this point in the history