Commit Graph

208 Commits

Author SHA1 Message Date
Jeremy Soller 13b93e0f90 Merge branch 'master' into 'master'
fix(redox-rt/signal/x86_64): corrupted `r8`/`r10`

See merge request redox-os/relibc!817
2025-12-17 21:34:45 -07:00
Anhad Singh afbd5986a5 fix(redox-rt/signal/x86_64): corrupted r8/r10
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-18 14:03:13 +11:00
Ibuki Omatsu efa5b73015 refactor: Replace unlink and rmdir with unlinkat. Improve fork using ForkScratchPad. 2025-12-17 18:32:07 -07:00
Anhad Singh f7aa718596 fix(redox-rt/proc): min_mmap_addr being set too low
`cmp::min` -> `cmp::max` Want to make sure we set the `min_mmap_addr` to
the top of the executable.

`update_min_mmap_addr(STACK_TOP - STACK_SIZE, STACK_SIZE);` needs to be
removed since we cannot allocate above that.

Reverts to the old behaviour. In future may want to consider loading the
executeable here instead of the dynamic linker (and before the dynamic
linker) to avoid any further conflicts.

Fixes `gcc` crashing at "failed to map
/usr/libexec/gcc/x86_64-unknown-redox/13.2.0/cc1. errno: 17" (where 17
-> EEXIST).

Co-authored-by: @bjorn3
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-12 17:49:36 +11:00
Anhad Singh 3f986068e9 fix(redox-rt/proc): from_raw should negate raw for
`KillProcTarget::ProcGroup`

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-10 14:46:16 +11:00
bjorn3 dc77995b57 redox-rt: Remove unnecessary image_file field from FexecResult::Interp 2025-12-09 22:22:09 +01:00
bjorn3 c96aeea39f redox-rt: Get rid of BTreeMap usage in fexec_impl 2025-12-09 21:04:45 +01:00
bjorn3 0158b111e0 redox-rt: Use non-fixed and anonymous remote mmap 2025-12-09 21:04:40 +01:00
bjorn3 1ede79fe88 Move cloexec and deactivate_tcb handling into redox-rt 2025-12-08 22:19:57 +01:00
bjorn3 b607877c07 Move cloexec handling to happen right before the final exec
This way if the target can't be executed, cloexec fds remain open as
expected.
2025-12-08 20:39:55 +01:00
bjorn3 4dae665cbf Hard code the default scheme to file
Init no longer changes the default scheme to initfs at any point in
time. And for sandboxing you would be switching scheme namespace, not
default scheme.

It should be possible to mix and match relibc version from before and
after this change without breaking exec, though I haven't tested it.
2025-12-07 19:51:45 +01:00
bjorn3 45a58f1a9e Account for nul terminator in total_args_envs_auxvpointee_size 2025-12-07 19:38:14 +01:00
bjorn3 6021ece539 Calculate total_args_envs_size in redox_rt::proc::fexec_impl
Calculating it earlier is a micro-optimization that doesn't seem like it
matters at all compared to all other costs of spawning a process. But at
the same time it makes things more fragile. And in fact bootstrap
actually passed the wrong value. It passed the
total_args_envs_auxvpointee_size that it computed rather than the
total_args_envs_size. While over-approximation doesn't cause UB, it
unnecessarily increases the amount of memory used after exec.

In addition pass &[&[u8]] rather than iterators for args and envs to
enable precomputing the total arg and env size. This also prevents you
from forgetting to pass a reversed iterator.
2025-12-07 18:52:47 +01:00
Jeremy Soller 01f01d3bd4 Fix for F_DUPFD_CLOEXEC, add TODO for usage in upper table 2025-11-17 17:46:57 -07:00
Jeremy Soller 0844e6fc90 WIP: use upper fd table 2025-11-15 07:55:37 -07:00
Ibuki Omatsu 06d5cb0bfd fix: Fix getpeername for unix sockets adding SocketCall::GetPeerName and using SYS_CALL. 2025-11-10 06:20:46 -07:00
Jeremy Soller 222278edf9 Format 2025-11-01 10:41:15 -06:00
Jeremy Soller ab2a948d0b Abort on panic or oom, remove stabilized let_chains feature 2025-10-30 09:33:29 -06:00
Josh Megnauth e39b27664f unsafe_op_in_unsafe_fn: ld_so, generic/redox-rt
There are a few functions where I allowed the lint. The lower level and
FFI nature of relibc means that there are areas with a lot of unsafe.
Some functions are basically long blocks of unsafe or contain lots of
small blocks of unsafe. unsafe_op_in_unsafe_fn doesn't add clarity to
these functions. Instead, it reduces readability by adding an indent or
small "unsafe { .. }" clutter.
2025-10-04 21:36:51 -04:00
Jeremy Soller 7ed934a01d Fix compilation of redox-rt without proc feature 2025-10-04 08:05:46 -06:00
Jeremy Soller 82084440ad Support nightly-2025-10-03 2025-10-03 21:51:10 -06:00
Jeremy Soller 43b0f235ca Implement pthread_getattr_np 2025-09-30 12:49:22 -06:00
4lDO2 3ad1ba516e sigaltstack: don't fail when onstack && new==NULL. 2025-09-20 11:38:14 +02:00
4lDO2 38e724ece9 Properly inherit ignored sigs across exec. 2025-09-20 11:08:41 +02:00
4lDO2 37c2f3026a Clear pending SIGCHLD also when set to SIG_DFL. 2025-09-20 10:37:26 +02:00
4lDO2 437786f6a1 Restrict posix_exit to & 0xFF to fix EINVAL panic. 2025-09-10 15:10:06 +02:00
4lDO2 23c65bab66 Revert to using abort() for extraordinary panics. 2025-09-09 20:09:29 +02:00
Jeremy Soller 7c4a87da39 Merge branch 'getens' into 'master'
Add getens and expose it to libredox

See merge request redox-os/relibc!705
2025-09-09 07:35:19 -06:00
Ibuki Omatsu b14aae168f Add getens and expose it to libredox 2025-09-09 07:35:19 -06:00
elle e148be2296 redox-rt: remove unused code from proc 2025-09-08 21:03:28 +00:00
elle 5a8c166e67 redox-rt: clean up unused code
Removes unused imports, and replaces calls to `core::intrinsics::abort`
with `panic` macro call.
2025-09-08 21:03:28 +00:00
elle 5032708f88 redox-rt: fix dead code in sync 2025-09-08 21:03:27 +00:00
elle 9f446e2fd3 redox-rt: remove signal dead code 2025-09-08 21:03:27 +00:00
elle bd13557f98 lib: remove array_chunks nightly feature
Removes the nightly `array_chunks` feature, since it is marked as
unlikely to be merged.

Usage is trivially refactored using iterators.
2025-09-08 17:08:22 +00:00
4lDO2 518798f64e Return EINVAL when killing with sig > 64. 2025-07-18 21:50:01 +02:00
4lDO2 40b8064eae Fix raise signal number being -32. 2025-07-18 20:35:33 +02:00
Ibuki Omatsu d44010170f feat: Integrate UDS bind and connect operation with RedoxFS and switch get_proc_credentials to a capability-based approach. 2025-07-18 08:57:49 -06:00
Ibuki Omatsu 206239f9a2 feat: Implement Unix Domain Socket and related features. 2025-07-17 22:48:37 -06:00
4lDO2 f216665916 No-op, don't exit, as result of SIG_DFL SIGCONT. 2025-04-21 15:23:28 +02:00
4lDO2 32c5e89c82 Return ID of new session in setsid. 2025-04-20 17:10:51 +02:00
4lDO2 696ae4eca1 Add DisableSetpgid call. 2025-04-20 16:24:46 +02:00
4lDO2 8f234edf69 Fix riscv64 fork asm. 2025-04-19 19:27:04 +02:00
4lDO2 2fe8dc8f6e Add (untested) riscv64 sighandler SYS_CALL asm. 2025-04-19 19:27:03 +02:00
4lDO2 0e0246bc69 Let procmgr handle process names. 2025-04-19 19:27:03 +02:00
4lDO2 8cfc7e8fac Do not treat ppid as constant. 2025-04-19 19:27:03 +02:00
4lDO2 aa034fccc8 Compile on riscv64gc. 2025-04-19 19:27:03 +02:00
4lDO2 e6c06a7cf7 Fix signals for spawned threads, and async signal waiting. 2025-04-19 19:27:03 +02:00
4lDO2 35357b2f14 Clear pending when act becomes Ign (no multi-thread). 2025-04-19 19:27:03 +02:00
4lDO2 a1937f438c Allow read-only sigaction for SIG{KILL,STOP}. 2025-04-19 19:27:03 +02:00
4lDO2 8f2d9ef1db Ensure allowset bits for SIGSTOP and SIGKILL are always set. 2025-04-19 19:27:03 +02:00