File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,6 +182,9 @@ pub fn sys_clone(
182182 exit_signal,
183183 ) ;
184184 proc_data. set_umask ( old_proc_data. umask ( ) ) ;
185+ // Inherit heap pointers from parent to ensure child's heap state is consistent after fork
186+ proc_data. set_heap_bottom ( old_proc_data. get_heap_bottom ( ) ) ;
187+ proc_data. set_heap_top ( old_proc_data. get_heap_top ( ) ) ;
185188
186189 {
187190 let mut scope = proc_data. scope . write ( ) ;
Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ pub fn sys_execve(
6565
6666 * proc_data. signal . actions . lock ( ) = Default :: default ( ) ;
6767
68+ // Clear set_child_tid after exec since the original address is no longer valid
69+ curr. as_thread ( ) . set_clear_child_tid ( 0 ) ;
70+
6871 // Close CLOEXEC file descriptors
6972 let mut fd_table = FD_TABLE . write ( ) ;
7073 let cloexec_fds = fd_table
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ pub fn new_user_task(
3333 TaskInner :: new (
3434 move || {
3535 let curr = axtask:: current ( ) ;
36+
3637 access_user_memory ( || {
3738 if let Some ( tid) = set_child_tid {
3839 * tid = curr. id ( ) . as_u64 ( ) as Pid ;
You can’t perform that action at this time.
0 commit comments