c3ae8022bad7e1aca96524ff47558bd5f5ae9cde
This reverts commit b0dde81c75.
The main issue was not with "access" being used, it was with errno being
accessed. This patch accesses errno as well
LD_LIBRARY_PATH="/folder/with/no/libc" ./a.out
gives segfault with the following stack trace
0x00000000004d1cae in relibc::platform::sys::e (sys=18446744073709551614) at src/platform/linux/mod.rs:54
54 errno = -(sys as isize) as c_int;
(gdb) bt
#0 0x00000000004d1cae in relibc::platform::sys::e (sys=18446744073709551614) at src/platform/linux/mod.rs:54
#1 0x00000000004d361e in <relibc::platform::sys::Sys as relibc::platform::pal::Pal>::open (path=0x5555555634c0, oflag=524288, mode=0) at src/platform/linux/mod.rs:330
#2 0x000000000049a2ad in relibc::fs::File::open (path=0x5555555634c0, oflag=524288) at src/fs.rs:28
#3 0x0000000000482b49 in relibc::ld_so::linker::Linker::load_recursive (self=0x7fffffffdd30, name=..., path=...) at src/ld_so/linker.rs:119
#4 0x0000000000484963 in relibc::ld_so::linker::Linker::load_library (self=0x7fffffffdd30, name=...) at src/ld_so/linker.rs:184
#5 0x0000000000483b53 in relibc::ld_so::linker::Linker::load_data (self=0x7fffffffdd30, name=..., data=...) at src/ld_so/linker.rs:152
#6 0x00000000004831fe in relibc::ld_so::linker::Linker::load_recursive (self=0x7fffffffdd30, name=..., path=...) at src/ld_so/linker.rs:140
#7 0x000000000048228a in relibc::ld_so::linker::Linker::load (self=0x7fffffffdd30, name=..., path=...) at src/ld_so/linker.rs:97
#8 0x0000000000414a3b in relibc_ld_so_start (sp=0x7fffffffe310, ld_entry=4198896) at src/ld_so/start.rs:182
#9 0x0000000000401209 in _start () at src/ld_so/src/lib.rs:10
#10 0x0000000000000001 in ?? ()
#11 0x00007fffffffe592 in ?? ()
#12 0x0000000000000000 in ?? ()
relibc 
relibc is a portable POSIX C standard library written in Rust. It is under heavy development, and currently supports Redox and Linux.
The motivation for this project is twofold: Reduce issues the redox crew was having with newlib, and create a safer alternative to a C standard library written in C. It is mainly designed to be used under redox, as an alternative to newlib, but it also supports linux syscalls via the sc crate.
Contributing
Supported OSes
- Redox OS
- Linux
Supported architectures
- x86_64
- Aarch64
Description
RedBear Operating System, based on RedoxOS. Licenced under MIT license.
https://redbearos.org
Languages
Rust
99.6%
Linker Script
0.2%
Makefile
0.1%
Shell
0.1%