From nobody Tue Feb 10 04:30:42 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4f97sh0HTJz6RPWl for ; Tue, 10 Feb 2026 04:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f97sg4Nwrz3c1Q for ; Tue, 10 Feb 2026 04:30:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770697847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i/FuAbFW9ULmQfqFP3ERkkgX7VFyc9SDv5H6HyvakIg=; b=DNvXbdBxktdXxbpMdAQ7SOJeH1iccB4YN7xuxC92ysFMFE5sKJ5muzfAHToMswzDMooSZw HLCvrtEfytMkq+rMa5UWbY8n0Vi2ntLhBYQFwEwWY0OZbn3QnEWp7533kx9x5slD0/IS7L ULWzL+XFq3yIOOLoeEu/u2Rfvwhgyo5Y5gbj0fUVdxEQvWdsTZAaTA5mN2jxanmUcGKuiI P2vDcDHAPoSiW0x5wtAnqfns49FYx2tzzlgFkynLu6WrmCyCfDYd5udNKxAzGJkHyXA38B LhNgh+tjueGcv27j0k0ihB78jTHOFcj2QAeBrc7Z26P+a2fugBEjXdYHMi9FXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770697847; a=rsa-sha256; cv=none; b=RXYL9Mfryo7xSZzoUKE6kusz232GjOUChVoB2XV8db2wV9RJY6vCSILBzXt72asF5352hc aMj9MukVcyQwBp41P4t+FlGx5J0pCKZIChf45LVzJS7EwtgPMhgSk/4Taa4P5+5Covk6/r uNl3GoOzqL+/NVH41nx0TNKUesLeO2lzQ+D/bF15fPsQlRhC4hbk/CX8K0fd+eoFDTdgJv b5uwVO7kVDnj9Eab2uoVvBiED01gU5ThAyx5+cCrG24qbEWkilHwLzCjLLIGyRe5+rwka4 myTltFm2zkCjewG3JVnfU6azJ7MR1MbMYNckrEl/vVkHqGQKEfq2pxfdobpgdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770697847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i/FuAbFW9ULmQfqFP3ERkkgX7VFyc9SDv5H6HyvakIg=; b=ZJI8ha6BWSdclP/ZwG4bHyPgIgK5intCP5VkCOLsvEd5Hogfr7Hr3P/z9/9TO8RUp+Vsjl ro24Uo7hUxhsumqCzkqhCm6EgJiuqPHK49mOBi/a8pj9tr2nVyc6tOV7eUwbAhD/IgzQ+S VpL0k4EVG6NW21KGi/teb1C01NfyxVdfeOSi5yIWRe3uyl4NilEwpQVedI20/f8iVE5yfX NLfSycB5qFYpymZJngB87NTHnl2zUdpjeDavhM1oHfVMc6XPQDlQ99fway0gXWzriF5Fcb NI1q+V5VoaNMbpnnM6RG5x0PgVtLertzEfr/l1h4HzlNpALdiHP0cGN1TTiHwQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f97sg3VCVz138Z for ; Tue, 10 Feb 2026 04:30:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22e23 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 10 Feb 2026 04:30:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jose Luis Duran Subject: git: 30c04399f2e8 - stable/14 - Adapt changes from blocklist 2026-02-07 (10a907f) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 30c04399f2e81b8e71045fc410837461abeb2d8b Auto-Submitted: auto-generated Date: Tue, 10 Feb 2026 04:30:42 +0000 Message-Id: <698ab472.22e23.7fc9056b@gitrepo.freebsd.org> The branch stable/14 has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=30c04399f2e81b8e71045fc410837461abeb2d8b commit 30c04399f2e81b8e71045fc410837461abeb2d8b Author: Jose Luis Duran AuthorDate: 2026-02-10 02:05:42 +0000 Commit: Jose Luis Duran CommitDate: 2026-02-10 02:26:13 +0000 Adapt changes from blocklist 2026-02-07 (10a907f) Also apply the fix from PR 258411. This is a direct commit to stable/14, as blacklist has been renamed to blocklist upstream. --- contrib/blocklist/bin/blacklistd.c | 29 +++++++------- contrib/blocklist/bin/blacklistd.conf.5 | 4 +- contrib/blocklist/bin/run.c | 13 +++--- contrib/blocklist/bin/support.c | 1 - contrib/blocklist/port/popenve.c | 71 +++++++++++++++++---------------- 5 files changed, 61 insertions(+), 57 deletions(-) diff --git a/contrib/blocklist/bin/blacklistd.c b/contrib/blocklist/bin/blacklistd.c index 714abcbcaf0e..ded8e684f63c 100644 --- a/contrib/blocklist/bin/blacklistd.c +++ b/contrib/blocklist/bin/blacklistd.c @@ -339,10 +339,10 @@ addfd(struct pollfd **pfdp, bl_t **blp, size_t *nfd, size_t *maxfd, exit(EXIT_FAILURE); if (*nfd >= *maxfd) { *maxfd += 10; - *blp = realloc(*blp, sizeof(**blp) * *maxfd); + *blp = reallocarray(*blp, *maxfd, sizeof(**blp)); if (*blp == NULL) err(EXIT_FAILURE, "malloc"); - *pfdp = realloc(*pfdp, sizeof(**pfdp) * *maxfd); + *pfdp = reallocarray(*pfdp, *maxfd, sizeof(**pfdp)); if (*pfdp == NULL) err(EXIT_FAILURE, "malloc"); } @@ -366,7 +366,7 @@ uniqueadd(struct conf ***listp, size_t *nlist, size_t *mlist, struct conf *c) } if (*nlist == *mlist) { *mlist += 10; - void *p = realloc(*listp, *mlist * sizeof(*list)); + void *p = reallocarray(*listp, *mlist, sizeof(*list)); if (p == NULL) err(EXIT_FAILURE, "Can't allocate for rule list"); list = *listp = p; @@ -451,8 +451,8 @@ main(int argc, char *argv[]) case 's': if (nblsock >= maxblsock) { maxblsock += 10; - void *p = realloc(blsock, - sizeof(*blsock) * maxblsock); + void *p = reallocarray(blsock, maxblsock, + sizeof(*blsock)); if (p == NULL) err(EXIT_FAILURE, "Can't allocate memory for %zu sockets", @@ -527,14 +527,15 @@ main(int argc, char *argv[]) state = state_open(dbfile, flags, 0600); if (state == NULL) state = state_open(dbfile, flags | O_CREAT, 0600); - if (state == NULL) - return EXIT_FAILURE; - - if (restore) { - if (!flush) - rules_flush(); - rules_restore(); + else { + if (restore) { + if (!flush) + rules_flush(); + rules_restore(); + } } + if (state == NULL) + exit(EXIT_FAILURE); if (!debug) { if (daemon(0, 0) == -1) @@ -556,7 +557,7 @@ main(int argc, char *argv[]) if (errno == EINTR) continue; (*lfun)(LOG_ERR, "poll (%m)"); - return EXIT_FAILURE; + exit(EXIT_FAILURE); case 0: state_sync(state); break; @@ -572,5 +573,5 @@ main(int argc, char *argv[]) update(); } state_close(state); - return 0; + exit(EXIT_SUCCESS); } diff --git a/contrib/blocklist/bin/blacklistd.conf.5 b/contrib/blocklist/bin/blacklistd.conf.5 index 70036441eb4b..e557e51a9642 100644 --- a/contrib/blocklist/bin/blacklistd.conf.5 +++ b/contrib/blocklist/bin/blacklistd.conf.5 @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 18, 2020 +.Dd January 13, 2026 .Dt BLACKLISTD.CONF 5 .Os .Sh NAME @@ -102,7 +102,7 @@ The syntax for the .Va location is: .Bd -literal -offset indent - [
|][/][:] + [
|[/]:] .Ed .Pp The diff --git a/contrib/blocklist/bin/run.c b/contrib/blocklist/bin/run.c index 5588f0198c04..e11f8b28e2ef 100644 --- a/contrib/blocklist/bin/run.c +++ b/contrib/blocklist/bin/run.c @@ -62,10 +62,10 @@ static char * run(const char *cmd, const char *name, ...) { const char *argv[20]; - size_t i; + size_t i, len; va_list ap; FILE *fp; - char buf[10240], *res; + char *line, *res; argv[0] = "control"; argv[1] = cmd; @@ -77,6 +77,7 @@ run(const char *cmd, const char *name, ...) va_end(ap); if (debug) { + char buf[2048]; size_t z; int r; @@ -97,10 +98,10 @@ run(const char *cmd, const char *name, ...) (*lfun)(LOG_ERR, "popen %s failed (%m)", controlprog); return NULL; } - if (fgets(buf, sizeof(buf), fp) != NULL) - res = strdup(buf); - else - res = NULL; + line = res = NULL; + len = 0; + if (getline(&line, &len, fp) >= 0) + res = line; pclose(fp); if (debug) (*lfun)(LOG_DEBUG, "%s returns %s", cmd, res); diff --git a/contrib/blocklist/bin/support.c b/contrib/blocklist/bin/support.c index d560d2303223..3e14fcbdc688 100644 --- a/contrib/blocklist/bin/support.c +++ b/contrib/blocklist/bin/support.c @@ -117,7 +117,6 @@ fmtydhms(char *b, size_t l, time_t t) y = t; - z = 0; o = 0; #define APPEND(a) \ if (a) { \ diff --git a/contrib/blocklist/port/popenve.c b/contrib/blocklist/port/popenve.c index 20f6b5b86b68..df57cde9d51f 100644 --- a/contrib/blocklist/port/popenve.c +++ b/contrib/blocklist/port/popenve.c @@ -45,19 +45,19 @@ __RCSID("$NetBSD: popenve.c,v 1.2 2015/01/22 03:10:50 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ -#include -#include +#include #include +#include #include #include +#include #include #include #include #include #include #include -#include #ifdef __weak_alias __weak_alias(popen,_popen) @@ -71,8 +71,8 @@ static struct pid { int fd; #endif pid_t pid; -} *pidlist; - +} *pidlist; + #ifdef _REENTRANT static rwlock_t pidlist_lock = RWLOCK_INITIALIZER; #endif @@ -109,11 +109,25 @@ pdes_get(int *pdes, const char **type) #endif } - if ((cur = malloc(sizeof(*cur))) != NULL) - return cur; + if ((cur = malloc(sizeof(*cur))) != NULL) { + if (**type == 'r') { + cur->fp = fdopen(pdes[0], *type); +#ifdef _REENTRANT + cur->fd = pdes[0]; +#endif + } else { + cur->fp = fdopen(pdes[1], *type); +#ifdef _REENTRANT + cur->fd = pdes[1]; +#endif + } + if (cur->fp != NULL) + return cur; + } serrno = errno; (void)close(pdes[0]); (void)close(pdes[1]); + free(cur); errno = serrno; return NULL; } @@ -123,16 +137,6 @@ pdes_child(int *pdes, const char *type) { struct pid *old; - /* POSIX.2 B.3.2.2 "popen() shall ensure that any streams - from previous popen() calls that remain open in the - parent process are closed in the new child process. */ - for (old = pidlist; old; old = old->next) -#ifdef _REENTRANT - (void)close(old->fd); /* don't allow a flush */ -#else - (void)close(fileno(old->fp)); /* don't allow a flush */ -#endif - if (type[0] == 'r') { (void)close(pdes[0]); if (pdes[1] != STDOUT_FILENO) { @@ -148,31 +152,30 @@ pdes_child(int *pdes, const char *type) (void)close(pdes[0]); } } + + /* POSIX.2 B.3.2.2 "popen() shall ensure that any streams + from previous popen() calls that remain open in the + parent process are closed in the new child process. */ + for (old = pidlist; old; old = old->next) { +#ifdef _REENTRANT + (void)close(old->fd); /* don't allow a flush */ +#else + (void)close(fileno(old->fp)); /* don't allow a flush */ +#endif + } } static void pdes_parent(int *pdes, struct pid *cur, pid_t pid, const char *type) { - FILE *iop; - - /* Parent; assume fdopen can't fail. */ - if (*type == 'r') { - iop = fdopen(pdes[0], type); -#ifdef _REENTRANT - cur->fd = pdes[0]; -#endif + /* Parent */ + if (*type == 'r') (void)close(pdes[1]); - } else { - iop = fdopen(pdes[1], type); -#ifdef _REENTRANT - cur->fd = pdes[1]; -#endif + else (void)close(pdes[0]); - } /* Link into list of file descriptors. */ - cur->fp = iop; - cur->pid = pid; + cur->pid = pid; cur->next = pidlist; pidlist = cur; } @@ -198,7 +201,7 @@ popenve(const char *cmd, char *const *argv, char *const *envp, const char *type) #ifdef _REENTRANT (void)rwlock_rdlock(&pidlist_lock); #endif - switch (pid = vfork()) { + switch (pid = fork()) { case -1: /* Error. */ serrno = errno; #ifdef _REENTRANT