From nobody Tue Feb 21 17:05:53 2023 X-Original-To: dev-commits-src-all@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 4PLlzk0b72z3sttT; Tue, 21 Feb 2023 17:05:54 +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 4PLlzk026lz3QVp; Tue, 21 Feb 2023 17:05:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676999154; 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=xLmRanEkYy9lvZMkzlYvK1+SXJp57c4oG5BFApQqdlw=; b=M7srNvEv8EC7JHORGj7yqKRMHuxdtfV/J9Y8P9grLKYW4wp9AQJrqRQSyHyYuUrO/dFep0 qwgm+jYceTg+R9v5hHWQS2Berl6OJNe8Q3sk6HZjkIOfZG4zleQd7vYo4xXmkpUIJD1AqZ 067h/HEeuuF64i/lfNJjxEmRq7YeFlsUNf1MVzgVDErkJfrbrDhfN9jYoGqiud1T9ge6JY Vy0NHIP6CRTofM3IIo0j+rP9oMehyKt9wlvR5TrDNGsB+v/p7z68PBXkHmdSdiVxsr41N/ amr7rRsh9B8I8ujhZ3QlTY21dezMlQSQHK3gRshfTQOjPEa8gC/dWpuvHjTHhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676999154; 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=xLmRanEkYy9lvZMkzlYvK1+SXJp57c4oG5BFApQqdlw=; b=HocmPRprZuVqCrnrCDjj59iKAqqNN0pr4chpYmjO1AyNQSw/ivc5+e0Gkn71732pIObDA4 uLpWBp8qNiREVtHR1F35vKCI3OjPD2BK/VARfI3Nmd0ekFwGfJwO6uWnUxYaKqBdHdjb4c 0QC1Cx31Rf+XEiK5qjJd80A0aQwPdFjdy9L0MXMF5w/nJQ9Qc2BSbYAddcHlgojS3hjqRp HRB25wYE4wX4NLkoOVueo6wI0ybLZydNtebqpkot4UYfto2JlrmSu2Km9fNLM9FwJCj1Ic 9PM8hg9qZemzPlTy9QMRD/TzHgsCHV1JF+tiqvEuy4BGRltkTdCxeoZuUK6hhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676999154; a=rsa-sha256; cv=none; b=uSDlWeeM8jwp0yMLQVhFeF+VRERzmEQWY+Sab5QsvBggdUKYA/zvyOI+RQzo3T0Dx81scl 72McE8JZliv6dERbqeEW42msBXWngBZy/ZaudDeDhGxjsvK2WjFkwsoRdR34tmmWn1t3pm ZTavZi3cdcGytuBK2cUKH2uWmZ9zutL2McVk7uINMtzKy65Wm7WN3+g8NLIa+Y95vznl9B XdvAAEAPmgiue6Or+hnLHZW3mZ7ivzJOQ0apicJBJdP/sWDfwF5SL33M+ejVD59huSsUiR upVil107tMRaAGdCZFlKx0cNNz6vaBu5uETedGclDMPjdEK4m+gO1gAuBvS8oQ== 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 4PLlzj6ClqzT0F; Tue, 21 Feb 2023 17:05:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LH5r8n080165; Tue, 21 Feb 2023 17:05:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LH5r2X080164; Tue, 21 Feb 2023 17:05:53 GMT (envelope-from git) Date: Tue, 21 Feb 2023 17:05:53 GMT Message-Id: <202302211705.31LH5r2X080164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 71e70c25c008 - main - Revert "unix/dgram: return EAGAIN instead of ENOBUFS when O_NONBLOCK set" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71e70c25c0085a4e6e5eef834ca8a29b65435d62 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=71e70c25c0085a4e6e5eef834ca8a29b65435d62 commit 71e70c25c0085a4e6e5eef834ca8a29b65435d62 Author: Gleb Smirnoff AuthorDate: 2023-02-21 16:50:07 +0000 Commit: Gleb Smirnoff CommitDate: 2023-02-21 16:50:07 +0000 Revert "unix/dgram: return EAGAIN instead of ENOBUFS when O_NONBLOCK set" This API change led to unexpected consequences with Go runtime. The Go runtime emulates blocking sockets over non-blocking sockets and for that uses available event dispatcher on the target OS, which is kevent(2) if availabe, with OS independent layer on top. It expects that if whatever O_NONBLOCK socket returned ever EAGAIN, then it is supposed to be reported as writable by the event dispatcher. kevent(2) would never report a unix/dgram socket, since they never change their state, they always are writeable. The expectations of Go are not literally specified by SUS, however they are in its spirit. The SUS specifies EAGAIN for send(2) as "The socket's file descriptor is marked O_NONBLOCK and the requested operation would block" [1]. This doesn't apply to FreeBSD unix/dgram socket, it never blocks on send(2). Thus, changing API trying to mimic Linux was a mistake. But what about the problem we tried to fix? Discussed that with Max Dounin of nginx, and we agreed that the log bomb described shall be fixed on nginx side, and it actually isn't specific to FreeBSD, may happen with nginx on any non-Linux system with a certain configuration. [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html This reverts commit 65572cade35a93add2168a7a012f808ac499218b. --- sys/kern/uipc_usrreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 8f86bdb48c69..294ef807416c 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1338,7 +1338,7 @@ uipc_sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio, f = NULL; } else { soroverflow_locked(so2); - error = (so->so_state & SS_NBIO) ? EAGAIN : ENOBUFS; + error = ENOBUFS; if (f->m_next->m_type == MT_CONTROL) unp_scan(f->m_next, unp_freerights); }