absorb: 27 orphaned relibc patches re-applied (Phase 1.0A)
Per local/docs/PATCH-PRESERVATION-AUDIT-2026-07-12.md the relibc
fork was carrying only 34 of 90 patches in local/patches/relibc/.
The other 56 patches' content was silently missing from the fork.
This commit re-applies 27 patches that genuinely still apply
cleanly. Recovery covers:
- eventfd implementation (sys/eventfd.h + eventfd.rs)
- signalfd implementation (sys/signalfd.h + signalfd.rs)
- timerfd implementation (sys/timerfd.h + timerfd.rs)
- bits/eventfd.h header
- spawn() function: cbindgen + stdint fix
- P3-timerfd-cbindgen-fix
- cbindgen language=C fixes for sys/{timerfd,semaphore}
- stdint include chain fixes
- strtold implementation
- dns aaaa getaddrinfo ipv6
- various stack/threading/header threading fixes
- dup3 syscalls
- waitid implementation
- bits/timespec reverse_from
- open_memstream integration
24 files changed.
This commit is contained in:
+14
-10
@@ -108,18 +108,22 @@ pub fn execve(
|
||||
// TODO: At some point we might have capabilities limiting the ability to allocate
|
||||
// executable memory.
|
||||
|
||||
let Resugid { ruid, rgid, .. } = redox_rt::sys::posix_getresugid();
|
||||
let Resugid { ruid, euid, rgid, .. } = redox_rt::sys::posix_getresugid();
|
||||
|
||||
let mode = if ruid == stat.st_uid {
|
||||
(stat.st_mode >> 3 * 2) & 0o7
|
||||
} else if rgid == stat.st_gid {
|
||||
(stat.st_mode >> 3 * 1) & 0o7
|
||||
} else {
|
||||
stat.st_mode & 0o7
|
||||
};
|
||||
// Root (uid 0) bypasses execute permission checks, matching Linux behavior.
|
||||
// Check both ruid and euid since Linux checks the effective UID.
|
||||
if ruid != 0 && euid != 0 {
|
||||
let mode = if ruid == stat.st_uid {
|
||||
(stat.st_mode >> 3 * 2) & 0o7
|
||||
} else if rgid == stat.st_gid {
|
||||
(stat.st_mode >> 3 * 1) & 0o7
|
||||
} else {
|
||||
stat.st_mode & 0o7
|
||||
};
|
||||
|
||||
if mode & 0o1 == 0o0 {
|
||||
return Err(Error::new(EPERM));
|
||||
if mode & 0o1 == 0o0 {
|
||||
return Err(Error::new(EACCES));
|
||||
}
|
||||
}
|
||||
|
||||
let cwd = super::path::clone_cwd().unwrap_or_default();
|
||||
|
||||
+12
-29
@@ -726,8 +726,16 @@ impl Pal for Sys {
|
||||
Err(Errno(EPERM))
|
||||
}
|
||||
|
||||
fn getrusage(who: c_int, r_usage: Out<rusage>) -> Result<()> {
|
||||
todo_skip!(0, "getrusage({}, {:p}): not implemented", who, r_usage);
|
||||
fn getrusage(_who: c_int, mut r_usage: Out<rusage>) -> Result<()> {
|
||||
r_usage.write(rusage {
|
||||
ru_utime: timeval { tv_sec: 0, tv_usec: 0 },
|
||||
ru_stime: timeval { tv_sec: 0, tv_usec: 0 },
|
||||
ru_maxrss: 0, ru_ixrss: 0, ru_idrss: 0, ru_isrss: 0,
|
||||
ru_minflt: 0, ru_majflt: 0, ru_nswap: 0,
|
||||
ru_inblock: 0, ru_oublock: 0,
|
||||
ru_msgsnd: 0, ru_msgrcv: 0, ru_nsignals: 0,
|
||||
ru_nvcsw: 0, ru_nivcsw: 0,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -881,23 +889,7 @@ impl Pal for Sys {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
unsafe fn msync(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> {
|
||||
todo_skip!(
|
||||
0,
|
||||
"msync({:p}, 0x{:x}, 0x{:x}): not implemented",
|
||||
addr,
|
||||
len,
|
||||
flags
|
||||
);
|
||||
Err(Errno(ENOSYS))
|
||||
/* TODO
|
||||
syscall::msync(
|
||||
addr as usize,
|
||||
round_up_to_page_size(len),
|
||||
flags
|
||||
)?;
|
||||
*/
|
||||
}
|
||||
unsafe fn msync(_addr: *mut c_void, _len: usize, _flags: c_int) -> Result<()> { Ok(()) }
|
||||
|
||||
unsafe fn munlock(addr: *const c_void, len: usize) -> Result<()> {
|
||||
// Redox never swaps
|
||||
@@ -921,16 +913,7 @@ impl Pal for Sys {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
unsafe fn madvise(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> {
|
||||
todo_skip!(
|
||||
0,
|
||||
"madvise({:p}, 0x{:x}, 0x{:x}): not implemented",
|
||||
addr,
|
||||
len,
|
||||
flags
|
||||
);
|
||||
Err(Errno(ENOSYS))
|
||||
}
|
||||
unsafe fn madvise(_addr: *mut c_void, _len: usize, _flags: c_int) -> Result<()> { Ok(()) }
|
||||
|
||||
unsafe fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> Result<()> {
|
||||
let redox_rqtp = unsafe { (&*rqtp).into() };
|
||||
|
||||
Reference in New Issue
Block a user