Commit Graph

275 Commits

Author SHA1 Message Date
Red Bear OS 10023d5715 diag: cast errno to usize 2026-07-13 23:36:23 +03:00
Red Bear OS a11a5a9387 diag: fix format_errno call path 2026-07-13 23:34:39 +03:00
Red Bear OS 0d52729be0 diag: include path and errno in open() diagnostic 2026-07-13 23:33:21 +03:00
Red Bear OS 1c3b19e5f6 diag: fix no_std diagnostic in open() 2026-07-13 23:17:33 +03:00
Red Bear OS e1dc2780b0 diag: add open() diagnostic for scheme-creation-cap and pipe paths 2026-07-13 23:16:08 +03:00
Red Bear OS 381dd8ef20 fix: open() uses single SYS_OPENAT call — eliminates OtherScheme EOPNOTSUPP
The two-step pattern (open full path as scheme root, then open reference
relative to root_fd) failed for namespace-internal paths like
/scheme/namespace/scheme-creation-cap. The namespace scheme resolves the
full path and returns OtherScheme pointing to SchemeList (a kernel scheme
that does not implement kopenat). The second call then hits
SchemeList.kopenat() → EOPNOTSUPP.

The namespace scheme already handles reference resolution internally via
open_scheme_resource(), so a single SYS_OPENAT call with the full path
resolves everything. This also bypasses FILETABLE.insert_upper (which
previously collided with the untracked ns_fd at UPPER index 0).
2026-07-13 22:57:31 +03:00
Red Bear OS a540890851 relibc: fix open() to bypass FILETABLE.insert_upper collision
The open() function used openat_into_upper which calls
FILETABLE.insert_upper() to allocate UPPER fd slots. This can collide
with the namespace fd (ns_fd) that is stored in DYNAMIC_PROC_INFO,
causing the kernel to overwrite the namespace fd entry. All subsequent
open() calls then resolve to the wrong scheme.

Fix: use raw SYS_OPENAT syscalls (which auto-assign POSIX fds) and
register them with register_external_fd, bypassing insert_upper entirely.
2026-07-13 22:42:31 +03:00
Red Bear OS bb20fe9c76 Remove FEXEC_STEP diagnostic from proc.rs 2026-07-12 15:17:50 +03:00
Red Bear OS 5ee906eee3 fix: add MAP_SHARED to map_mut_anywhere flags
validate_kfmap_flags in kernel proc scheme requires exactly one of
MAP_SHARED or MAP_PRIVATE. Without it, shared == private == false,
and the check fails with EINVAL. This was the root cause of the
fexec_impl crash at step 62 (first PT_LOAD segment mapping).
2026-07-12 11:31:34 +03:00
Red Bear OS f643e1b58b fix: register external fds with userspace FILETABLE
redox-scheme Socket and RawEventQueue create fds via libredox raw
syscalls (SYS_DUP, openat) that bypass the redox-rt userspace
FILETABLE. When FdGuard::dup later reserves a POSIX fd slot via
FILETABLE.add_posix, it can reserve a position occupied by the
untracked socket fd. SYS_DUP_INTO then closes the socket and
replaces it, corrupting the procmgr's fd table.

Add register_external_fd() to redox-rt::sys that marks an
existing kernel fd as occupied in the userspace FILETABLE.
Call it from procmgr::run() for the socket fd and event queue
fd.
2026-07-12 11:17:57 +03:00
Red Bear OS 58dfd26452 diag: remove 31 FK: debug prints from redox-rt fork implementation
Removes all syscall::write(1, b'FK:...') debug trace lines from
fork_impl/fork_inner in redox-rt/src/proc.rs that were polluting
serial output during every fork() call.
2026-07-12 05:32:20 +03:00
Red Bear OS fa54b985ff 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.
2026-07-12 01:29:50 +03:00
Red Bear OS d60ba8730d Add granular FK: progress markers throughout fork_inner to pinpoint EOPNOTSUPP 2026-07-11 21:58:08 +03:00
Red Bear OS 64527aae68 debug: add FK:ENTER and FK:INNER markers to trace fork EOPNOTSUPP 2026-07-11 20:14:02 +03:00
Red Bear OS 2576fe453e redox-rt: add fork debug tracing to identify EOPNOTSUPP source 2026-07-11 17:40:31 +03:00
Jeremy Soller d58990030e Fix inverted pointer alignment checks 2026-07-09 13:28:42 -06:00
auronandace 8f3ac79670 tackle some clippy lints in redox-rt 2026-07-09 08:35:50 +01:00
Wildan M 9a03f5f9c4 Remove ExpectTlsFree 2026-07-06 16:31:47 +07:00
Wildan M fbb56200ab Handle panic without TCB 2026-07-06 16:08:59 +07:00
Ibuki.O d84be7571f fix: Always increment active_count in override_at to ensure synchronization 2026-07-05 11:23:00 +09:00
Wildan M 1c194990f8 Fix crash when exiting from detached thread 2026-07-05 04:05:30 +07:00
Wildan M 3cbcc916cd Fix panic at posix_exit due to EAGAIN 2026-07-04 19:55:58 +07:00
4lDO2 0434043c44 Dealloc TCB on detach/join rather than exit. 2026-07-04 13:48:31 +02:00
Ibuki Omatsu fba233467a refactor: Move fd allocation logic into userspace 2026-07-01 08:08:23 -06:00
Mathew John Roberts d0fdf6d026 Merge branch 'spawn-sh' into 'master'
Fix posix_spawn launching sh script

See merge request redox-os/relibc!1489
2026-06-23 06:39:38 +01:00
Wildan M b5e764d967 Fix posix_spawn launching sh script 2026-06-23 12:22:31 +07:00
Wildan M 0880176578 Handle EINTR in posix_exit 2026-06-23 01:53:29 +07:00
Wildan M 56d5fe6bce Fix posix_spawn various issues 2026-06-20 07:05:28 +07:00
auronandace 4674c47f2b apply function_casts_as_integer lint to other arches 2026-06-17 14:28:39 +01:00
R Aadarsh a6e1b269af * Make dup2 work
* Use `CloseCloExec` for closing O_CLOEXEC files
2026-06-15 17:08:11 +05:30
R Aadarsh 0810991d7d Do the requested sigmask changes and u/g id changes 2026-06-15 17:08:11 +05:30
R Aadarsh e3d2257f64 * Make posix_spawn_file_actions_t an iterator
* Fix bug that caused the spawned process to not start

* Make the spawned process inherit the parent's file descriptos
2026-06-15 17:08:11 +05:30
R Aadarsh 119f078216 * Fix bug that caused pid of the child process to be returned instead of 0 or errorno
* Add `same_process` field to not change the address space when `fexec_impl` is called on a different process
2026-06-15 17:08:11 +05:30
R Aadarsh 1bc472e7e1 Add posix_spawn and posix_spawnp for RedoxOS 2026-06-15 17:08:11 +05:30
sourceturner e39106835a fix compiler warnings 2026-06-04 17:33:37 +02:00
Ibuki Omatsu c2bcf91339 feat: Implement relpathat 2026-05-27 16:36:44 +02:00
Jeremy Soller ffa097ccb3 Support nightly 2026-05-24 2026-05-25 17:03:17 -06:00
aarch 20014bc121 RISCV64: Change VA scheme to Sv39 for real hardware support 2026-04-18 09:46:57 -06:00
Akshit Gaur 87b16e6d12 Priority Scheduler 2026-04-17 18:45:46 -06:00
auronandace 1bc532848f specify workspace dependencies 2026-03-23 08:32:25 +00:00
auronandace 0918f5bcb6 update goblin dependency 2026-03-18 11:00:33 +00:00
Ibuki.O ac88c8f670 refactor: Migrate fstat*/fchmod/getdents/ftruncate/futimens to stdfscall 2026-03-14 13:35:39 +09:00
Ibuki Omatsu cab0021461 refactor: Move protocols into libredox 2026-02-28 08:04:47 -07:00
Ibuki Omatsu bd9c6f1440 refactor: Make processes have cwd as a capability 2026-02-26 06:09:27 -07:00
Anhad Singh 09f52fd163 fix(redox-rt): FIXED_NOREPLACE for ET_EXEC
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-20 12:00:29 +11:00
Anhad Singh 4c0d4c7963 fix(redox-rt): update min mmap address for ET_EXEC
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-20 11:58:28 +11:00
Anhad Singh 4fbb8ec338 fix(redox-rt): add base address to e_entry
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-20 11:56:28 +11:00
auronandace 53273c35c4 remove allowed unused imports 2026-02-17 15:35:58 +00:00
Anhad Singh 0430081f4a feat(redox-rt): preload the executable
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-16 12:29:19 +11:00
Ibuki.O 29f8219d5d fix: Avoid UB by passing raw pointers to syscall5 2026-02-11 13:34:22 +09:00