sunfishcode / mustang

Rust programs written entirely in Rust
Other
849 stars 24 forks source link

Fix `execvp` on shell scripts. #211

Closed sunfishcode closed 1 year ago

sunfishcode commented 1 year ago

On Linux at least, execveat with a directory fd opened with O_CLOEXEC can't run programs that use #! such as shell scripts. So switch execvp back to allocating a buffer, using an mmap syscall so that it's safe to do in the child of a fork, and using plain execve.

Also, implement difftime and __strncmp_chk.