app: do not call printf in signal handlers
Checks
Commit Message
Using printf is not async-signal safe and worst case may lead to deadlock.
Remove printf from signal handlers present in several applications.
Testpmd was already fixed by
commit 0fd1386c30c3 ("app/testpmd: cleanup cleanly from signal")
Signed-off-by: Prateek Agarwal <prateekag@cse.iitb.ac.in>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/pdump/main.c | 2 --
app/test-eventdev/evt_main.c | 3 ---
app/test-flow-perf/main.c | 3 ---
app/test/test_pmd_perf.c | 1 -
4 files changed, 9 deletions(-)
Comments
On Mon, Jun 12, 2023 at 05:11:50PM -0700, Stephen Hemminger wrote:
> Using printf is not async-signal safe and worst case may lead to deadlock.
> Remove printf from signal handlers present in several applications.
>
> Testpmd was already fixed by
> commit 0fd1386c30c3 ("app/testpmd: cleanup cleanly from signal")
>
> Signed-off-by: Prateek Agarwal <prateekag@cse.iitb.ac.in>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
15/06/2023 22:14, Tyler Retzlaff:
> On Mon, Jun 12, 2023 at 05:11:50PM -0700, Stephen Hemminger wrote:
> > Using printf is not async-signal safe and worst case may lead to deadlock.
> > Remove printf from signal handlers present in several applications.
> >
> > Testpmd was already fixed by
> > commit 0fd1386c30c3 ("app/testpmd: cleanup cleanly from signal")
> >
> > Signed-off-by: Prateek Agarwal <prateekag@cse.iitb.ac.in>
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Applied, thanks for reviving this old patch.
@@ -571,8 +571,6 @@ static void
signal_handler(int sig_num)
{
if (sig_num == SIGINT) {
- printf("\n\nSignal %d received, preparing to exit...\n",
- sig_num);
quit_signal = 1;
}
}
@@ -21,9 +21,6 @@ static void
signal_handler(int signum)
{
if (signum == SIGINT || signum == SIGTERM) {
- printf("\nSignal %d received, preparing to exit...\n",
- signum);
-
if (test != NULL) {
/* request all lcores to exit from the main loop */
*(int *)test->test_priv = true;
@@ -1708,9 +1708,6 @@ static void
signal_handler(int signum)
{
if (signum == SIGINT || signum == SIGTERM) {
- printf("\n\nSignal %d received, preparing to exit...\n",
- signum);
- printf("Error: Stats are wrong due to sudden signal!\n\n");
force_quit = true;
}
}
@@ -318,7 +318,6 @@ signal_handler(int signum)
{
/* USR1 signal, stop testing */
if (signum == SIGUSR1) {
- printf("Force Stop!\n");
stop = 1;
}