Use a different format for passing argv/envp/auxv in execv
Currently, Redox's execve implementation emulates Linux's format for passing the argv and envp pointers, and the auxiliary vectors, but this has several downsides. The current implementation does lots of mmap calls, which although it could be improved anyway, would be significantly easier with a simpler format. It also currently requires Redox-specific auxiliary vectors, which are passed null-terminated, which is true for envp too. The sigprocmask and "sigignmask" (POSIX requires execve to remember which signals were ignored, but otherwise reset them), as well as some internal relibc fds, would likely also need a custom auxv.
A simpler format would instead pass a header struct, providing the values the mandatory auxvs would otherwise provide, which might look like the following:
struct Header {
args_base: *const u8,
args_len: usize,
envs_base: *const u8,
envs_len: usize,
stack_top: *const u8,
stack_len: usize,
cwd_base: *const u8,
cwd_len: usize,
phnum: u16,
phentsize: u16,
page_size: u32,
phdr: u64,
procmask: u64, // set to "all blocked" until overridden by this value
ignmask: u64, // set to "all SIG_DFL" or "all SIG_IGN" until overridden by this value
interp_header: *const Header, // nullable
hwcap: u64,
}
It might also be possible for the args and envs to not be NUL-terminated, since relibc is forced to copy them anyway.