From: Luca Boccassi Date: Thu, 4 Jan 2024 11:52:25 +0000 (+0100) Subject: udev: add upper bound of 5 hours to SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC= X-Git-Tag: v256-rc1~1285^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5af0f171f94a18ae0807679f45c757ebb146b35f;p=thirdparty%2Fsystemd.git udev: add upper bound of 5 hours to SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC= Follow-up for b16c6076cb334c9da9602d4bafbf60381d6d630e CID#1533111 --- diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md index b9a96be82c7..0113fd59fa2 100644 --- a/docs/ENVIRONMENT.md +++ b/docs/ENVIRONMENT.md @@ -253,7 +253,8 @@ All tools: udev manager process waits for a worker process kills slow programs specified by IMPORT{program}=, PROGRAM=, or RUN=, and finalizes the processing event. If the worker process cannot finalize the event within the specified timespan, - the worker process is killed by the manager process. Defaults to 10 seconds. + the worker process is killed by the manager process. Defaults to 10 seconds, + maximum allowed is 5 hours. `udevadm` and `systemd-hwdb`: diff --git a/src/udev/udev-manager.c b/src/udev/udev-manager.c index 5bf00bb2625..31944c22472 100644 --- a/src/udev/udev-manager.c +++ b/src/udev/udev-manager.c @@ -335,6 +335,7 @@ static int on_event_timeout_warning(sd_event_source *s, uint64_t usec, void *use static usec_t extra_timeout_usec(void) { static usec_t saved = 10 * USEC_PER_SEC; static bool parsed = false; + usec_t timeout; const char *e; int r; @@ -347,10 +348,15 @@ static usec_t extra_timeout_usec(void) { if (!e) return saved; - r = parse_sec(e, &saved); + r = parse_sec(e, &timeout); if (r < 0) log_debug_errno(r, "Failed to parse $SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC=%s, ignoring: %m", e); + if (timeout > 5 * USEC_PER_HOUR) /* Add an arbitrary upper bound */ + log_debug("Parsed $SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC=%s is too large, ignoring.", e); + else + saved = timeout; + return saved; }