Open yamt opened 2 hours ago
@hujun260 please look at this issue.
as nxsched_smp_call_single drops the critical section, there seems to be nothing to prevent the signal mask from changing in the meantime. it can end up with a signal delivered while being blocked.
I don't think this change caused https://github.com/apache/nuttx/issues/14749, because the release of the critical section is going to happen regardless of whether I call nxsched_smp_call_single or not.
similarly, the need_restore logic in sig_handler seems dangerous as it can revert unrelated changes to those fields.
There are two fields: affinity and flag. Due to the setting of TCB_FLAG_CPU_LOCKED, the affinity will not be changed during the process.
The tcb->flags may undergo changes, which I can further refine. During restoration, only the TCB_FLAG_CPU_LOCKED field of tcb->flags will be restored, without altering any other fields.
Description / Steps to reproduce the issue
the signal sending logic (kill) basically does:
as nxsched_smp_call_single drops the critical section, there seems to be nothing to prevent the signal mask from changing in the meantime. it can end up with a signal delivered while being blocked.
similarly, the need_restore logic in sig_handler seems dangerous as it can revert unrelated changes to those fields.
On which OS does this issue occur?
[OS: Mac]
What is the version of your OS?
macOS 14.7
NuttX Version
master
Issue Architecture
[Arch: all]
Issue Area
[Area: Kernel]
Verification