From nobody Tue Oct 24 21:09:04 2023 X-Original-To: dev-commits-ports-main@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 4SFPnD4KCZz4xWrW; Tue, 24 Oct 2023 21:09:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SFPnD3WqYz4dcB; Tue, 24 Oct 2023 21:09:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698181744; 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=VzAWmsNyM9ozyY3bstCzIB/K/o6/8HoF78C/wfX0rOw=; b=eqIqxsi6fEfoWk65OQCcwXeELlBY0DY+a2Rx/PlusCiIhUvSgPTNq4tpkB1VRXCEh2CpeH vx/HkV/KRYE/UIAeRhOAXwDDNGjrWBzxTkD+zqUZ6ktXyzayGBeo0gvMPzFVQEbyjx3IXX 9Qq0NI9HPEifUiYYKX6yam/3vVHm+VbEjr4mCgra+H8wjt1OJ3OV4t2A416Qagb8u5y5ql 6xi1LCqWJJ0diAyakLCiCru+DNZjvAPJGPts0q+bIaWifoOzD+fxrN//RNFDbcu/67eujp 8zLh2i5VnND1puCR2TxrTXscWIQs+fNHKuVZmOGkOilvDdfZu7vnU7yMSy3diA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698181744; a=rsa-sha256; cv=none; b=AICLgz3Gj8TK3onAfh9ds9ihdC1thFmj+R1oQf6sY2CKZq4G/jkgkCCH/J+3fED+631/o+ rGAbYOY/n5RmfWwa9qFtc6sZyaxLRFK4EAPEAj7dG/zEFDCgC7Cv4TEHIftCE24Aikxhcf rP5s4itPsMj7sdoIDF2wTMhZplT4usGow/wFmb73ErK7MCsE6mm3U2vUTogVrqU0V+ftCZ LC8mbo3aBA8fO18O3C1Y4N8yulQZj8Vx+iNQTNCxqmCfPGRVTpif5Db0lQfjyS5zKA+jcB C9z4HH9G+ST3uXruAkjgGqXNwHkU6u6MCj123IV9HuBJ2dzF/k5s3BscQf4Fkg== 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=1698181744; 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=VzAWmsNyM9ozyY3bstCzIB/K/o6/8HoF78C/wfX0rOw=; b=ZNRFMhzuh4+4seC1omE2xhdvK/vC3w6/7vczftE0+sizL8FQxFD4bBR+SqWKLwykepNgmK uOXsiC4/E+NI/yP2Bu+e8oMm25Mqh4Lagd/RF+8ZXF9LILevFkw9HWjmne8LpXFWcJ+h2R IQqT5l6ZUQbgnlvgTyPEF6fIw+zeE8YBFSV3/Wrm9kq/gFcNI7A7b+wTr8LdDPDSux06x1 J3Pnl/ukW7/765lHa8xbeY51IEw6XYrPh3mxx8Uz+om2LAO8vYo4WSYUc3xqSQk2ZO9D5V PENtplsjuBkqlXu5vpYONTXlEDvRy6oJfHrFqY8ewAWJL4g7GofapWn+a1nHZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SFPnD2TZNzdg3; Tue, 24 Oct 2023 21:09:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39OL94T2041631; Tue, 24 Oct 2023 21:09:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39OL94UH041628; Tue, 24 Oct 2023 21:09:04 GMT (envelope-from git) Date: Tue, 24 Oct 2023 21:09:04 GMT Message-Id: <202310242109.39OL94UH041628@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Matthew Seaman Subject: git: 959521fd0d96 - main - sysutils/rsyslog8: patch for forking issue due to close_range() call List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: matthew X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 959521fd0d960b4bf9938a2229f29959ee2f8fa3 Auto-Submitted: auto-generated The branch main has been updated by matthew: URL: https://cgit.FreeBSD.org/ports/commit/?id=959521fd0d960b4bf9938a2229f29959ee2f8fa3 commit 959521fd0d960b4bf9938a2229f29959ee2f8fa3 Author: Nathan Huff AuthorDate: 2023-10-24 21:04:00 +0000 Commit: Matthew Seaman CommitDate: 2023-10-24 21:08:41 +0000 sysutils/rsyslog8: patch for forking issue due to close_range() call Add patch from upstream: https://github.com/rsyslog/rsyslog/commit/599b5c7524b76cfc73245206fcce1e2b4d955f21 After fork if the child process uses close_range to close open file descriptors it has no way to exempt the parentPipeFD causing a failure to signal successful startup to the parent process. This causes failures on all systems that aren't Linux that implement close_range. 1. Loop through file descriptors between beginClose and MAX(parentPipeFD,dbgGetDbglogFd()) making sure not to close those two file descriptors. 2. Potentially use close_range to close all file descriptors above MAX(parentPipeFD,dbgGetDbglogFd()) PR: 274509 Reported by: Helmut Ritter Obtained from: https://github.com/rsyslog/rsyslog/pull/5254 --- sysutils/rsyslog8/Makefile | 4 +-- sysutils/rsyslog8/files/patch-tools_rsyslogd.c | 36 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/sysutils/rsyslog8/Makefile b/sysutils/rsyslog8/Makefile index 8df79aa1a249..a81c1ce7fae3 100644 --- a/sysutils/rsyslog8/Makefile +++ b/sysutils/rsyslog8/Makefile @@ -1,6 +1,6 @@ PORTNAME= rsyslog PORTVERSION= 8.2310.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils MASTER_SITES= http://www.rsyslog.com/files/download/rsyslog/ @@ -8,8 +8,6 @@ MAINTAINER= matthew@FreeBSD.org COMMENT= Syslogd supporting SQL, TCP, and TLS WWW= https://www.rsyslog.com/ -BROKEN= "Socket operation on non-socket" See PR 274509 - LICENSE= GPLv3 LGPL3 APACHE20 LICENSE_COMB= multi diff --git a/sysutils/rsyslog8/files/patch-tools_rsyslogd.c b/sysutils/rsyslog8/files/patch-tools_rsyslogd.c new file mode 100644 index 000000000000..a4fdaf7a965c --- /dev/null +++ b/sysutils/rsyslog8/files/patch-tools_rsyslogd.c @@ -0,0 +1,36 @@ +--- tools/rsyslogd.c.orig 2023-10-09 07:12:48 UTC ++++ tools/rsyslogd.c +@@ -460,19 +460,24 @@ prepareBackground(const int parentPipeFD) + /* try MacOS, FreeBSD */ + if(close_unneeded_open_files("/proc/fd", beginClose, parentPipeFD) != 0) { + /* did not work out, so let's close everything... */ +- const int endClose = getdtablesize(); +-# if defined(HAVE_CLOSE_RANGE) +- if(close_range(beginClose, endClose, 0) != 0) { ++ int endClose = (parentPipeFD > dbgGetDbglogFd()) ? parentPipeFD : dbgGetDbglogFd(); ++ for(int i = beginClose ; i <= endClose ; ++i) { ++ if((i != dbgGetDbglogFd()) && (i != parentPipeFD)) { ++ aix_close_it(i); /* AIXPORT */ ++ } ++ } ++ beginClose = endClose + 1; ++ endClose = getdtablesize(); ++#if defined(HAVE_CLOSE_RANGE) ++ if(close_range(beginClose, endClose, 0) !=0) { + dbgprintf("errno %d after close_range(), fallback to loop\n", errno); +-# endif ++#endif + for(int i = beginClose ; i <= endClose ; ++i) { +- if((i != dbgGetDbglogFd()) && (i != parentPipeFD)) { +- aix_close_it(i); /* AIXPORT */ +- } ++ aix_close_it(i); /* AIXPORT */ + } +-# if defined(HAVE_CLOSE_RANGE) ++#if defined(HAVE_CLOSE_RANGE) + } +-# endif ++#endif + } + } + seedRandomNumberForChild();