Conversation
|
Plz do not close and reopen one pr over and over again... 😢 |
Im SORRY. Some bugs fixed and I am adapting to the contribution process. Sorry teacher. |
I have tested the Asterinas testing program as per your request, and the main functional test results have been recorded in the discussion: https://github.com/orgs/Starry-OS/discussions/21 |
AsakuraMizu
left a comment
There was a problem hiding this comment.
Using traits is overkill. I prefer to use type conversion to achieve uniformity.
api/src/syscall/task/clone3.rs
Outdated
| let args_ptr = args_ptr as *const Clone3Args; | ||
| let args = unsafe { args_ptr.vm_read_uninit()?.assume_init() }; |
There was a problem hiding this comment.
You may want to derive bytemuck::AnyBitPattern on Clone3Args to avoid the use of unsafe.
|
Sorry I forgot to commit my review 😢 |
api/src/syscall/task/clone3.rs
Outdated
| // SAFETY: Clone3Args is a POD type with all fields being u64, which are Zeroable | ||
| unsafe impl bytemuck::Zeroable for Clone3Args {} | ||
|
|
||
| // SAFETY: Clone3Args is a POD type with no invalid bit patterns | ||
| unsafe impl bytemuck::AnyBitPattern for Clone3Args {} |
api/src/syscall/task/clone.rs
Outdated
| let pidfd_obj = PidFd::new(&new_proc_data); | ||
| let fd = pidfd_obj.add_to_fd_table(true)?; | ||
|
|
||
| // In clone3, pidfd field is used; in sys_clone, parent_tid is reused |
There was a problem hiding this comment.
I'm still confused by this. I think pidfd should be always used, and set to correct value when constructing CloneArgs in sys_clone.
api/src/syscall/task/clone3.rs
Outdated
| } | ||
| } | ||
|
|
||
| pub fn sys_clone3(uctx: &UserContext, args_ptr: usize, args_size: usize) -> AxResult<isize> { |
There was a problem hiding this comment.
| pub fn sys_clone3(uctx: &UserContext, args_ptr: usize, args_size: usize) -> AxResult<isize> { | |
| pub fn sys_clone3(uctx: &UserContext, args: *const Clone3Args, size: usize) -> AxResult<isize> { |
Description
This PR adds initial support for the
clone3system call in StarryOS.The implementation introduces the basic
clone3syscall path and supportsa commonly used subset of
clone3flags, enabling user programs and teststo create new processes using the modern
clone3interface.This work lays the groundwork for improving Linux compatibility and enables
future support for thread creation and synchronization primitives built on
top of
clone3(e.g., futex-based threading).Implementation
clone3syscall handler and integrated it into the syscalldispatch framework.
clone3arguments and flags,including:
exit_signalCLONE_PARENT_SETTIDCHILD_CLEARTIDexpected Linux error semantics where possible.
Some Linux features related to
clone3(e.g., session/process group semanticsand
PR_SET_CHILD_SUBREAPER) are not yet supported in StarryOS and aredocumented as known limitations.
Additional Context
clone3test programsand passes basic functionality tests.
do not block the correctness of this initial
clone3support.focused on establishing a correct and minimal clone3 syscall foundation.