-
Notifications
You must be signed in to change notification settings - Fork 1.5k
{bp-13633} riscv_fork.c: Fix vfork() for kernel mode + SMP #13789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was an error in the fork() routine when system calls are in use: the child context is saved on the child's user stack, which is incorrect, the context must be saved on the kernel stack instead. The result is a full system crash if (when) the child executes on a different CPU which does not have the same MMU mappings active.
We need to record the parent's integer register context upon exception entry to a separate non-volatile area. Why? Because xcp.regs can move due to a context switch within the fork() system call, be it either via interrupt or a synchronization point. Fix this by adding a "sregs" area where the saved user context is placed. The critical section within fork() is also unnecessary.
|
[Experimental Bot, please feedback here] NuttX PR Requirements ReviewMissing Information:
Concise Assessment: The PR addresses a critical issue in |
|
Oops Hi @xiaoxiang781216: Wonder if we are building with the https://github.com/apache/nuttx/actions/runs/11154095098/job/31002846380 |
|
@xiaoxiang781216 I think we have a bug in build.yml: https://github.com/apache/nuttx/pull/9289/files
- name: Checkout apps repo
uses: actions/checkout@v4
with:
repository: apache/nuttx-apps
ref: ${{ steps.gittargets.outputs.apps_ref }}This is causing the incorrect version of NuttX Apps to be checked out. Update: I have submitted the PR: #13806 |
Summary
There was an error in the fork() routine when system calls are in use: the child context is saved on the child's user stack, which is incorrect, the context must be saved on the kernel stack instead.
The result is a full system crash if (when) the child executes on a different CPU which does not have the same MMU mappings active.
Impact
RELEASE
Testing
CI