pussuw opened a new pull request, #14700: URL: https://github.com/apache/nuttx/pull/14700
## Summary There is an enormous error in the system call dispatch logic; if a task is inside a critical section (local interrupts disabled) there is a chance that during a context switch when the task resumes, local interrupts are erroneously ENABLED. This obviously leads to unexpected crashes and such. This happens when the CPU status has Previous Interrupt Enable (PIE) set to 1, even though Interrupt Enable (IE) is set to 0. When the system call returns via ERET, the CPU sets PIE->IE and if PIE=1 interrupts get enabled. This is fixed easily by explicitly CLEARING PIE from the register save area, if IE=0 when the system call was started. ## Impact RISC-V kernel mode only. Fixes a very well hidden bug in context switching. ## Testing ostest: - rv-virt:knsh64 - rv-virt:ksmp64 Downstream MPFS target with: - BUILD_KERNEL=y - both SMP=y and SMP=n - over 100 processes and threads -- 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-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org