Description / Steps to reproduce the issue
Summary
I believe there's been a behavior regression caused by #14104, may also be related to #16334.
Impact
Behavior:
- Before: sending a SIGINT (via
CONFIG_TTY_SIGINT) gets received by arbitrary programs run through NSH
- After: sending a SIGINT (via
CONFIG_TTY_SIGINT) gets processed, but is ignored due to a group mismatch on sig_dispatch.c:736.
The actual issue seems to be with the check of group == this_task()->group, where a program in sleep passes off to the scheduler (? sorry, I'm not familiar with the specifics), meaning that this_task()->group gets the group from g_idletcb which does not match the program sleeping in the foreground.
Testing
Reverting changes from nxsig_tgkill() to nxsig_kill() allow signals to be received by a program in usleep().
Using the nucleo-l432kc:nsh configuration, with the following config changes:
CONFIG_TTY_SIGINT=y
CONFIG_TTY_SIGINT_CHAR=0x03
CONFIG_SIG_DEFAULT=y
CONFIG_SIG_SIGKILL_ACTION=y
CONFIG_SIG_SIGSTOP_ACTION=y
CONFIG_GROUP_KILL_CHILDREN_TIMEOUT_MS=-1
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXAMPLES_HELLO_PROGNAME="hello"
CONFIG_EXAMPLES_HELLO_PRIORITY=100
CONFIG_EXAMPLES_HELLO_STACKSIZE=2048
Example implementation using hello example app:
/****************************************************************************
* apps/examples/hello/hello_main.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <signal.h>
/****************************************************************************
* Public Functions
****************************************************************************/
volatile bool _ok;
void _handler(int sig) {
_ok = false;
}
/****************************************************************************
* hello_main
****************************************************************************/
int main(int argc, FAR char *argv[])
{
printf("Hello, World...\n");
_ok = true;
signal(SIGINT, _handler);
while(_ok) {
usleep(10*1000*1000);
}
printf("Bye!\n");
return 0;
}
Output pressing CTRL-C before changes during the usleep():
Output pressing CTRL-C before changes during the usleep():
Where the program never exits.
On which OS does this issue occur?
[OS: Linux]
What is the version of your OS?
OpenSUSE Linux 6.15.8-1.0.2.sr20250701-default
NuttX Version
12.10.0
Issue Architecture
[Arch: arm]
Issue Area
[Area: Posix]
Host information
No response
Verification
Description / Steps to reproduce the issue
Summary
I believe there's been a behavior regression caused by #14104, may also be related to #16334.
Impact
Behavior:
CONFIG_TTY_SIGINT) gets received by arbitrary programs run through NSHCONFIG_TTY_SIGINT) gets processed, but is ignored due to a group mismatch on sig_dispatch.c:736.The actual issue seems to be with the check of
group == this_task()->group, where a program in sleep passes off to the scheduler (? sorry, I'm not familiar with the specifics), meaning thatthis_task()->groupgets the group fromg_idletcbwhich does not match the program sleeping in the foreground.Testing
Reverting changes from
nxsig_tgkill()tonxsig_kill()allow signals to be received by a program inusleep().Using the
nucleo-l432kc:nshconfiguration, with the following config changes:Example implementation using
helloexample app:Output pressing CTRL-C before changes during the
usleep():Hello, World... Bye!Output pressing CTRL-C before changes during the
usleep():Where the program never exits.
On which OS does this issue occur?
[OS: Linux]
What is the version of your OS?
OpenSUSE Linux 6.15.8-1.0.2.sr20250701-default
NuttX Version
12.10.0
Issue Architecture
[Arch: arm]
Issue Area
[Area: Posix]
Host information
No response
Verification