]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
selftests/watchdog-test: Fix system accidentally reset after watchdog-test
authorLi Zhijian <lizhijian@fujitsu.com>
Tue, 29 Oct 2024 03:13:24 +0000 (11:13 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 29 Oct 2024 03:34:43 +0000 (21:34 -0600)
When running watchdog-test with 'make run_tests', the watchdog-test will
be terminated by a timeout signal(SIGTERM) due to the test timemout.

And then, a system reboot would happen due to watchdog not stop. see
the dmesg as below:
```
[ 1367.185172] watchdog: watchdog0: watchdog did not stop!
```

Fix it by registering more signals(including SIGTERM) in watchdog-test,
where its signal handler will stop the watchdog.

After that
 # timeout 1 ./watchdog-test
 Watchdog Ticking Away!
 .
 Stopping watchdog ticks...

Link: https://lore.kernel.org/all/20241029031324.482800-1-lizhijian@fujitsu.com/
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/watchdog/watchdog-test.c

index bc71cbca0dde704b80619f4f64f864a82c6269cf..a1f506ba557864bdae7316d12a79de2d852ab2a0 100644 (file)
@@ -334,7 +334,13 @@ int main(int argc, char *argv[])
 
        printf("Watchdog Ticking Away!\n");
 
+       /*
+        * Register the signals
+        */
        signal(SIGINT, term);
+       signal(SIGTERM, term);
+       signal(SIGKILL, term);
+       signal(SIGQUIT, term);
 
        while (1) {
                keep_alive();