You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "casaroli (via GitHub)" <gi...@apache.org> on 2026/10/17 17:16:32 UTC
[PR] sched/task: Restore the parent environment only after a select in fork(). [nuttx]
casaroli opened a new pull request, #20717:
URL: https://github.com/apache/nuttx/pull/20717
## Summary
When `addrenv_fork()` failed, `nxtask_setup_fork()` still called `fork_restore_parent_env()`. `addrenv_restore()` then gave back a reference to the parent's address environment that `addrenv_select()` never took. When the parent exited, its address environment was destroyed while a CPU still had it selected, and the next switch to it found no page tables (`up_addrenv_select()` assertion).
This PR restores the parent's environment only if the child has one.
## Impact
Only the error path of `fork()` in builds with `CONFIG_ARCH_ADDRENV` changes. The bug came with `fork()` for address environments (#19562).
## Testing
Builds: `qemu-armv8a:nsh`, `qemu-armv8a:knsh`, `lm3s6965-ek:qemu-flat`.
Runtime, QEMU 11 with HVF on an Apple M4: `ostest` on `qemu-armv8a:knsh` (kernel build) and `qemu-armv8a:nsh` (flat build) ends with `ostest_main: Exiting with status 0`.
`tools/checkpatch.sh -c -u -m -g` passes.
The error path was reached with page-allocation fault injection on `qemu-armv8a:knsh` (`addrenv_fork()` failing at random): before, the parent's address environment was later destroyed while selected and `up_addrenv_select()` asserted; with the change, 4 injection runs with 30 failed `fork()` calls completed with no assertion.
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] sched/task: Restore the parent environment only after a select in fork(). [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #20717:
URL: https://github.com/apache/nuttx/pull/20717
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] sched/task: Restore the parent environment only after a select in fork(). [nuttx]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20717:
URL: https://github.com/apache/nuttx/pull/20717#issuecomment-6237545955
<!-- membrowse-pr-comment -->
## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report
*No memory changes detected for:*
- [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=d22654b6f3089d7f34c7507694fb2ee6f2794ba7&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=d22654b6f3089d7f34c7507694fb2ee6f2794ba7&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=d22654b6f3089d7f34c7507694fb2ee6f2794ba7&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=d22654b6f3089d7f34c7507694fb2ee6f2794ba7&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=d22654b6f3089d7f34c7507694fb2ee6f2794ba7&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=d22654b6f3089d7f34c7507694fb2ee6f2794ba7&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=d22654b6f3089d7f34c7507694fb2ee6f2794ba7&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=d22654b6f3089d7f34c7507694fb2ee6f2794ba7&base=17747ded0aaba11af1dd07422c15354200e65e3e)
- [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=d22654b6f3089d7f34c7507694fb2ee6f2794ba7&base=17747ded0aaba11af1dd07422c15354200e65e3e)
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org