mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-01 21:23:51 -09:00
package/watchdogd: bump to version 4.1
Changes: - Add watchdogctl list-clients command to display currently subscribed clients to the process supervisor. Outputs to stdout in either table format (default) with colored headers, or JSON format with -j/--json - New global -j, --json option for machine-readable output, currently supported by list-clients and status commands - New API: wdog_clients() returns array of wdog_client_t structs for programmatic access to subscribed clients. See API documentation at https://codedocs.xyz/troglobit/watchdogd/wdog_8h.html - Enhance watchdogctl status command to display formatted output by default, with device information, capabilities, and reset history in a human-readable table format. Use -j/--json for JSON output Fixes: - Generic scripts running more than 1 second would fail with false "critical error" reports and cause unwanted system reboots due to uninitialized exit status variable - watchdogctl reload with tempmon crashes watchdogd - Issue causing unwanted reboot when watchdogctl reload was called while a generic monitor script was running - Fix memory leak in generic monitor with optional script path, would be triggered on watchdogctl reload The first of the fixes means we can now drop the backported patch. Also, the test mode has been dropped from public use, hence it being removed as well in this commit. Signed-off-by: Joachim Wiberg <troglobit@gmail.com> Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
committed by
Julien Olivain
parent
e42b3de3b1
commit
ca3855c13f
@@ -146,6 +146,12 @@ endif
|
||||
|
||||
comment "Legacy options removed in 2026.02"
|
||||
|
||||
config BR2_PACKAGE_WATCHDOGD_TEST_SUITE
|
||||
bool "The watchdogd test mode option has been removed."
|
||||
select BR2_LEGACY
|
||||
help
|
||||
watchdogd v4.1 removes the test mode and test suite.
|
||||
|
||||
config BR2_KERNEL_HEADERS_6_17
|
||||
bool "kernel headers version 6.17.x are no longer supported"
|
||||
select BR2_LEGACY
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
From f6d56c374723923e276ccfd442fdd0cabf23d095 Mon Sep 17 00:00:00 2001
|
||||
From: Fiona Klute <fiona.klute@gmx.de>
|
||||
Date: Fri, 14 Feb 2025 19:26:24 +0100
|
||||
Subject: [PATCH] Fix use of uninitialized exit status
|
||||
|
||||
Depending on the timing between the SIGCHLD callback run and the first
|
||||
generic_cb() timer callback run, script_exit_status() sometimes
|
||||
returned uninitialized memory as the exit status of a script. This
|
||||
could lead to incorrect "critical error" reports if that uninitialized
|
||||
memory happened to contain a value that interpreted as an int was
|
||||
above the critical threshold.
|
||||
|
||||
Additionally, script_exit_status() unconditionally removed the process
|
||||
information from the queue, meaning that if a process had not
|
||||
completed by the time its status was first probed, its status could
|
||||
never be updated or successfully probed again, leading to timeout. Fix
|
||||
this by removing the process only if the status indicates it has
|
||||
terminated (successful or not).
|
||||
|
||||
The problems affected primarily scripts running approximately one
|
||||
second or longer, because very short running scripts will very likely
|
||||
have their exit status collected by the SIGCHLD callback before the
|
||||
first timer callback run.
|
||||
|
||||
Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
|
||||
Upstream: https://github.com/troglobit/watchdogd/pull/52
|
||||
---
|
||||
src/script.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/script.c b/src/script.c
|
||||
index 1220fb9..f6e0763 100644
|
||||
--- a/src/script.c
|
||||
+++ b/src/script.c
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
+#include <stdbool.h> /* bool type (before C23) */
|
||||
#include <stdlib.h> /* setenv() */
|
||||
#include <sys/wait.h> /* waitpid() */
|
||||
#include <unistd.h> /* execv(), _exit() */
|
||||
@@ -28,6 +29,7 @@
|
||||
struct exec_info {
|
||||
pid_t pid;
|
||||
int exit_status;
|
||||
+ bool exited;
|
||||
void (*cb)(void *arg);
|
||||
void *arg;
|
||||
LIST_ENTRY(exec_info) entry;
|
||||
@@ -64,6 +66,8 @@ static void add(pid_t pid, void (*cb)(void *), void *arg)
|
||||
}
|
||||
|
||||
info->pid = pid;
|
||||
+ info->exit_status = 0;
|
||||
+ info->exited = false;
|
||||
info->cb = cb;
|
||||
info->arg = arg;
|
||||
LIST_INSERT_HEAD(&exec_info_head, info, entry);
|
||||
@@ -78,6 +82,7 @@ static int exec(pid_t pid, int status)
|
||||
continue;
|
||||
|
||||
info->exit_status = status;
|
||||
+ info->exited = true;
|
||||
if (info->cb)
|
||||
info->cb(info->arg);
|
||||
|
||||
@@ -96,9 +101,11 @@ int script_exit_status(pid_t pid)
|
||||
if (info->pid != pid)
|
||||
continue;
|
||||
|
||||
- status = info->exit_status;
|
||||
- LIST_REMOVE(info, entry);
|
||||
- free(info);
|
||||
+ if (info->exited) {
|
||||
+ status = info->exit_status;
|
||||
+ LIST_REMOVE(info, entry);
|
||||
+ free(info);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
|
||||
--
|
||||
2.47.2
|
||||
|
||||
@@ -20,13 +20,6 @@ config BR2_PACKAGE_WATCHDOGD
|
||||
|
||||
if BR2_PACKAGE_WATCHDOGD
|
||||
|
||||
config BR2_PACKAGE_WATCHDOGD_TEST_SUITE
|
||||
bool "Enable watchdogctl test cases"
|
||||
help
|
||||
The watchdogctl program comes with a suite of tests built-in.
|
||||
They can be used to verify correct operation of watchdogd and
|
||||
the kernel watchdog driver.
|
||||
|
||||
config BR2_PACKAGE_WATCHDOGD_GENERIC
|
||||
bool "Generic script monitor"
|
||||
default y if BR2_PACKAGE_WATCHDOGD_GENERIC_POLL_WRAP # legacy 2024.02
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Upstream .sha256 from GitHub
|
||||
sha256 7f38bc691353a51fc6feb2ccab60417c0284dd3f4d55c50d8b1781fda70d8101 watchdogd-4.0.tar.gz
|
||||
sha256 7ae90acfd8879145be6fb9afe0f388e461230ce76ff9b8f4daeb93250351c314 watchdogd-4.1.tar.gz
|
||||
|
||||
# Locally calculated
|
||||
sha256 e233c56d807c74c67f2eff47ad03c216144cdd374d8d7578b996c28c260eadda LICENSE
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
WATCHDOGD_VERSION = 4.0
|
||||
WATCHDOGD_VERSION = 4.1
|
||||
WATCHDOGD_SITE = https://github.com/troglobit/watchdogd/releases/download/$(WATCHDOGD_VERSION)
|
||||
WATCHDOGD_LICENSE = ISC
|
||||
WATCHDOGD_LICENSE_FILES = LICENSE
|
||||
@@ -15,14 +15,7 @@ WATCHDOGD_SELINUX_MODULES = watchdog
|
||||
|
||||
WATCHDOGD_CONF_OPTS = \
|
||||
--disable-compat \
|
||||
--disable-examples \
|
||||
--disable-test-mode
|
||||
|
||||
ifneq ($(BR2_PACKAGE_WATCHDOGD_TEST_SUITE),y)
|
||||
WATCHDOGD_CONF_OPTS += --disable-builtin-tests
|
||||
else
|
||||
WATCHDOGD_CONF_OPTS += --enable-builtin-tests
|
||||
endif
|
||||
--disable-examples
|
||||
|
||||
ifneq ($(BR2_PACKAGE_WATCHDOGD_GENERIC),y)
|
||||
WATCHDOGD_CONF_OPTS += --without-generic
|
||||
|
||||
Reference in New Issue
Block a user