]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: add upper bound of 5 hours to SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC=
authorLuca Boccassi <bluca@debian.org>
Thu, 4 Jan 2024 11:52:25 +0000 (12:52 +0100)
committerLuca Boccassi <bluca@debian.org>
Thu, 4 Jan 2024 13:30:20 +0000 (14:30 +0100)
Follow-up for b16c6076cb334c9da9602d4bafbf60381d6d630e

CID#1533111

docs/ENVIRONMENT.md
src/udev/udev-manager.c

index b9a96be82c770be4d378c6dc11e582e74280c788..0113fd59fa206ed3374771d0536bf7323bbce31f 100644 (file)
@@ -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`:
 
index 5bf00bb26255abb1e53c89d12b719d9335453bc8..31944c224723126f77f462583389b40551d09f67 100644 (file)
@@ -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;
 }