Gary-Hobson opened a new pull request, #18116:
URL: https://github.com/apache/nuttx/pull/18116

   ## Summary
   
   This PR fixes a critical bug where pressing Ctrl-C in a serial console does 
not deliver SIGINT to the foreground process, preventing proper process 
termination.
   
   ### Root Cause:
   The serial driver called `nxsig_tgkill(-1, dev->pid, signo)` from interrupt 
context. With `pid=-1`, `nxsig_dispatch()` was invoked with `thread=true`, 
which requires `stcb->group == this_task()->group`. However, in interrupt 
context, `this_task()` returns the IDLE task, whose group differs from the 
target process group. This caused the signal dispatch to fail with `-ESRCH`.
   
   ### Changes:
   - Replace `nxsig_tgkill(-1, pid, signo)` with `nxsig_kill(pid, signo)` in 
serial_dma.c
   - Replace `nxsig_tgkill(-1, pid, signo)` with `nxsig_kill(pid, signo)` in 
serial_io.c
   
   The `nxsig_kill()` function uses `thread=false`, which routes through 
`group_signal()` without the same-group check, allowing signals to be delivered 
correctly from interrupt context.
   
   ## Impact
   
   - **Features**: Fixes Ctrl-C signal delivery in serial console environments
   - **User Experience**: Users can now properly terminate foreground processes 
with Ctrl-C
   - **Build**: No build system changes required
   - **Hardware**: Affects all platforms using serial console with signal 
support
   - **Documentation**: No documentation changes needed
   - **Security**: No security implications
   - **Compatibility**: Fully backward compatible, no API changes
   
   ## Testing
   
   Tested on sim and arm64 platforms with serial console configurations.


-- 
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