yushuailong opened a new pull request, #20651:
URL: https://github.com/apache/nuttx/pull/20651

   ## Summary
   
   Fix two related consistency issues in `task_reparent()`.
   
   * Reject `task_reparent(0, child)` when the current parent does not have a 
valid parent process.
     * A parent PID of zero previously resolved to the idle task's 
`g_kthread_group`.
     * This could incorrectly move the child into the kernel-thread group and 
discard its retained child status.
     * The invalid grandparent case now returns `-ESRCH`.
   
   * Update the child's `tg_ppid` only after child-status accounting has been 
migrated successfully.
     * The previous implementation changed `tg_ppid` before removing the child 
record from the old parent.
     * If the expected child-status entry was missing, the function returned 
`-ENOENT` after partially changing the relationship.
     * The new implementation leaves the original parent relationship unchanged 
when child-status migration fails.
   
   Apply both fixes to configurations with and without `HAVE_GROUP_MEMBERS`.
   
   
   ## Impact
   
   * Is new feature added? **NO**.
   * Is existing behavior changed? **YES**. Invalid grandparent reparenting now
     returns `-ESRCH`, and failed child-status migration no longer leaves a
     partially updated parent relationship.
   * Impact on users? **NO application changes are required**.
   * Impact on build? **NO**.
   * Impact on hardware? **NO**. This is architecture-independent scheduler 
code.
   * Impact on documentation? **NO**.
   * Impact on security? **NO known direct security impact**.
   * Impact on compatibility? **NO intended compatibility impact**. The changes
     only correct invalid and failed reparent operations.
   
   ## Testing
   
   Build host: macOS 26.6.2 ARM64, Apple Clang 21.0.0.  
   Target: sim:ostest.  
   Build: make completes successfully with LD: nuttx.  
   Static checks: nxstyle, checkpatch pass.  
   Runtime smoke test: ./nuttx starts and proceeds through enabled OSTest cases 
without an assertion in the observed run.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to