From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 04C80138334 for ; Thu, 9 May 2019 13:41:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ED7F5E082D; Thu, 9 May 2019 13:41:48 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C0015E082D for ; Thu, 9 May 2019 13:41:48 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 90384343E5F for ; Thu, 9 May 2019 13:41:46 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A5649549 for ; Thu, 9 May 2019 13:41:44 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1557409290.eb1d80e6a30d09f9f139877c5b754c8a8e918d7a.floppym@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/files/, sys-apps/systemd/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-apps/systemd/files/242-socket-util-flush-accept.patch sys-apps/systemd/systemd-242-r1.ebuild sys-apps/systemd/systemd-242.ebuild X-VCS-Directories: sys-apps/systemd/ sys-apps/systemd/files/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: eb1d80e6a30d09f9f139877c5b754c8a8e918d7a X-VCS-Branch: master Date: Thu, 9 May 2019 13:41:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 89f2b054-4cc2-4595-8a30-71595d074dc9 X-Archives-Hash: 731b183e0d4258ec60f0c788cf4e74b0 commit: eb1d80e6a30d09f9f139877c5b754c8a8e918d7a Author: Mike Gilbert gentoo org> AuthorDate: Thu May 9 13:41:30 2019 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Thu May 9 13:41:30 2019 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb1d80e6 sys-apps/systemd: backport patch to fix dracut boot Closes: https://bugs.gentoo.org/685002 Package-Manager: Portage-2.3.66_p2, Repoman-2.3.12_p111 Signed-off-by: Mike Gilbert gentoo.org> .../files/242-socket-util-flush-accept.patch | 46 ++++++++++++++++++++++ .../{systemd-242.ebuild => systemd-242-r1.ebuild} | 1 + 2 files changed, 47 insertions(+) diff --git a/sys-apps/systemd/files/242-socket-util-flush-accept.patch b/sys-apps/systemd/files/242-socket-util-flush-accept.patch new file mode 100644 index 00000000000..4849c4c0789 --- /dev/null +++ b/sys-apps/systemd/files/242-socket-util-flush-accept.patch @@ -0,0 +1,46 @@ +From f3d75364fbebf2ddb6393e54db5e10b6f6234e14 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 18 Apr 2019 15:13:54 +0200 +Subject: [PATCH] socket-util: make sure flush_accept() doesn't hang on + unexpected EOPNOTSUPP + +So apparently there are two reasons why accept() can return EOPNOTSUPP: +because the socket is not a listening stream socket (or similar), or +because the incoming TCP connection for some reason wasn't acceptable to +the host. THe latter should be a transient error, as suggested on +accept(2). The former however should be considered fatal for +flush_accept(). Let's fix this by explicitly checking whether the socket +is a listening socket beforehand. +--- + src/basic/socket-util.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c +index 904bafb76f9..e787d53d8f4 100644 +--- a/src/basic/socket-util.c ++++ b/src/basic/socket-util.c +@@ -1225,9 +1225,22 @@ int flush_accept(int fd) { + .fd = fd, + .events = POLLIN, + }; +- int r; ++ int r, b; ++ socklen_t l = sizeof(b); ++ ++ /* Similar to flush_fd() but flushes all incoming connection by accepting them and immediately ++ * closing them. */ ++ ++ if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &b, &l) < 0) ++ return -errno; + +- /* Similar to flush_fd() but flushes all incoming connection by accepting them and immediately closing them. */ ++ assert(l == sizeof(b)); ++ if (!b) /* Let's check if this is a socket accepting connections before calling accept(). That's ++ * because accept4() can return EOPNOTSUPP in the fd we are called on is not a listening ++ * socket, or in case the incoming TCP connection transiently triggered that (see accept(2) ++ * man page for details). The latter case is a transient error we should continue looping ++ * on. The former case however is fatal. */ ++ return -ENOTTY; + + for (;;) { + int cfd; diff --git a/sys-apps/systemd/systemd-242.ebuild b/sys-apps/systemd/systemd-242-r1.ebuild similarity index 99% rename from sys-apps/systemd/systemd-242.ebuild rename to sys-apps/systemd/systemd-242-r1.ebuild index d09494587fc..a2626727385 100644 --- a/sys-apps/systemd/systemd-242.ebuild +++ b/sys-apps/systemd/systemd-242-r1.ebuild @@ -171,6 +171,7 @@ src_prepare() { # Add local patches here PATCHES+=( "${FILESDIR}"/242-gcc-9.patch + "${FILESDIR}"/242-socket-util-flush-accept.patch ) if ! use vanilla; then