git: 959521fd0d96 - main - sysutils/rsyslog8: patch for forking issue due to close_range() call
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Oct 2023 21:09:04 UTC
The branch main has been updated by matthew: URL: https://cgit.FreeBSD.org/ports/commit/?id=959521fd0d960b4bf9938a2229f29959ee2f8fa3 commit 959521fd0d960b4bf9938a2229f29959ee2f8fa3 Author: Nathan Huff <nhuff@acm.org> AuthorDate: 2023-10-24 21:04:00 +0000 Commit: Matthew Seaman <matthew@FreeBSD.org> 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();