From nobody Thu Feb 08 17:01:06 2024 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 4TW3Cl1Dnwz5B2Mb; Thu, 8 Feb 2024 17:01:07 +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 4TW3Cl0DJhz4VCB; Thu, 8 Feb 2024 17:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707411667; 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=4a9c6Le7LvQjkIWH+Z3QB7wjCsA2mMkCbMbgMrnQSRA=; b=vadP8DVmtLeAJVqkwLEQ3iSn/mypoARq6EIvTkFFZs1bcLUDySTXtRvm6MxzdWe2xoGcJo z2e9URziLo5vOKm8RgmzWfafJccSVKLTvFXkCDvuSWPFu1jQ7tPt16+25sIrUbFZ8pfTtx 4NlofK0q6UCKK2XmMpHTY8LlJgwLSALe6+T/mCQhv1yQ9PleOaoLWxC1qGy39nAIpHtdr0 nSqLmsApyFFRtgaUMQ1R8I7ku5aK9Pkilh24VuDjNA1DakvbXlrZHu6kIblAtAecz/5016 G0zVGedkyZo86o+FwDl7ocjKyihJO9ulPDag8i9FTnOHE4NfuPS/ykrw7+TdXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707411667; 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=4a9c6Le7LvQjkIWH+Z3QB7wjCsA2mMkCbMbgMrnQSRA=; b=HXyceZtUxSp+FWHbyHWLQo/SKeY8gJB9XJGS69q7zKVmXtRcBQpX8K8aFrni5Peuo0hYw1 qbP9J9KQTK5bjsESl9sZ8ibKcUlY8o1DU7SY1uiscRD/ulWj9j8YDMuVpfbehloRMGSsor 7YvAosASPBJKTk/S6LPoLrisVxSgLyuP+AwoG5/LdT7RL5zVT6/XjubcRWlYcjyQXyH6gY qDljpXFeLF0/2h2tDN7JBBx9brDioo2rg1vhql8E13rW3qufvcKptaVqDJbL7krKmCM5/p mgP3Iquu10Qurv6hEAYkfO9iJ2DY5ipVKeRlm3lQsNiB4kiLDBsh62xdBEqKxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707411667; a=rsa-sha256; cv=none; b=ca03PO5OjtgMrpFgjM3ZmoOsBcVSVMouqRS/UoYAOgawQ4HUk1s1QfpzG0qVPC4epS/REK YxWLZiLz+WDkndlfH4SDdohi3BpAeTPtKpVi/UHYnkNfOSJLh88bZ/e3pjLcGu86SbTYpR jEaryYXdtBD5tQXYDp739xGNT3cxj4Y7E8fGI5h94QZuMPTqmbkkj7x1EM7S7qUmm5tLdc end+xa9jp6fkr2eWS9/2wmQU24uqGqSWqkmKb51vYvUXBU1PXXNkXhXIGnO3UfsvrC70p5 CfHn6kZUKtA0DW4SPSsZtnrwqVZDvkbEWyZHYtuHK2znP/P0fX1k6MqwsfzVxw== 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 4TW3Ck6RXvzxpF; Thu, 8 Feb 2024 17:01:06 +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 418H16tk065789; Thu, 8 Feb 2024 17:01:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 418H16XL065786; Thu, 8 Feb 2024 17:01:06 GMT (envelope-from git) Date: Thu, 8 Feb 2024 17:01:06 GMT Message-Id: <202402081701.418H16XL065786@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: 3ad0f9a58410 - main - tests/unix_passfd: add a comment for send_a_lot 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: 3ad0f9a584106b85569c6366ef8117a664fd55f8 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=3ad0f9a584106b85569c6366ef8117a664fd55f8 commit 3ad0f9a584106b85569c6366ef8117a664fd55f8 Author: Gleb Smirnoff AuthorDate: 2024-02-08 17:00:23 +0000 Commit: Gleb Smirnoff CommitDate: 2024-02-08 17:00:41 +0000 tests/unix_passfd: add a comment for send_a_lot Explain why SOCK_DGRAM and SOCK_STREAM differ in this edge case. While here improve output in case of a failure. --- tests/sys/kern/unix_passfd_test.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/sys/kern/unix_passfd_test.c b/tests/sys/kern/unix_passfd_test.c index 143ccd098583..74095859d899 100644 --- a/tests/sys/kern/unix_passfd_test.c +++ b/tests/sys/kern/unix_passfd_test.c @@ -657,11 +657,20 @@ ATF_TC_BODY(rights_creds_payload, tc) ATF_REQUIRE_MSG(len != -1 , "sendmsg failed: %s", strerror(errno)); #if TEST_PROTO == SOCK_STREAM ATF_REQUIRE_MSG((size_t)len < sendspace, - "sendmsg: %zd bytes sent", len); + "sendmsg: %zd bytes sent, expected < %lu", len, sendspace); #endif #if TEST_PROTO == SOCK_DGRAM + /* + * sendmsg(2) can't truncate datagrams, only recvmsg(2) can. There are + * two options for the kernel here: either accept the datagram with + * slight overcommit of the socket buffer space or return ENOBUFS for a + * datagram that is smaller or equal to the socket buffer space. Our + * implementation does overcommit. Explanation is simple: from our + * side we see space available, we have no idea that remote side has + * LOCAL_CREDS set. From our side we expect sendmsg(2) to succeed. + */ ATF_REQUIRE_MSG((size_t)len == sendspace, - "sendmsg: %zd bytes sent", len); + "sendmsg: %zd bytes sent, expected %lu", len, sendspace); #endif rlen = recvfd_payload(fd[1], &getfd, buf, len, CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)), 0);