Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from
.init_array
constructors to /proc/self/auxv. (#385)
* 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. * Remove the param `init` function from the libc backend. * Fix the no-std build. * Fix the backends test to accept that the default options now depend on libc. * Use `NonNull` in `check_raw_pointer`'s return type. This allows it to pack the return value into a single pointer-sized value. * Update more code to the new `check_raw_pointer` API. * Fix an unused-import warning. * Fix copy+paste. * Thread `check_elf_base` through `check_vdso_base` too.
- Loading branch information