Package: slirp Severity: important Tags: patch upstream Dear Maintainer,
When trying to use slirp with user-mode-linux (eth0=slirp) under Debian bookworm (amd64), I noticed that as soon as I up the virtual interface, slirp prints its usual banner and immediately exits with status 1. The slirp process started by UML becomes a zombie and there's no network connectivity. Some debugging led me to believe that the cause is signedness difference at src/main.c:955 in the if (timeout.tv_usec == -1) { ... } comparison, which makes the condition always false, thus reaching the select() call with timeout.tv_usec (of unsiged type) set to 0xffffffff (that is -1 converted to unsigned) and thus hitting EINVAL. Adding an explicit cast via the below patch helped. This problem might affect 64-bit architectures only; I tested on amd64. Please consider fixing this one way or another. Thanks, Feri. $ cat slirp-1.0.17/debian/patches/018-tv_usec-is-unsigned.patch Index: slirp-1.0.17/src/main.c =================================================================== --- slirp-1.0.17.orig/src/main.c 2023-08-07 11:49:03.000000000 +0200 +++ slirp-1.0.17/src/main.c 2023-08-07 11:57:06.850518113 +0200 @@ -859,7 +859,7 @@ * First, see the timeout needed by *timo */ timeout.tv_sec = 0; - timeout.tv_usec = -1; + timeout.tv_usec = (unsigned)-1; /* * If a slowtimo is needed, set timeout to 500ms from the last * slow timeout. If a fast timeout is needed, set timeout within @@ -952,7 +952,7 @@ * This will make timings (like idle timer and "wait" timer) * up to 10 seconds late, but will be more system friendly */ - if (timeout.tv_usec == -1) { + if (timeout.tv_usec == (unsigned)-1) { timeout.tv_usec = 0; timeout.tv_sec = 5; /* XXX */ }