From nobody Mon Aug 01 09:30:39 2022 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 4LxCXb6qnzz4Y6VG; Mon, 1 Aug 2022 09:30:39 +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 4LxCXb6PrZz3c9Q; Mon, 1 Aug 2022 09:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659346239; 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=NupGH4CLmN2Elsc5BOLJdm+iyKu+inHRtPtEv9i7i/I=; b=kPIoKfAz5syPfFCWtFIpQ6yWWCazIrIw6awnaj14cOcH04KWfLPiTuguFYwuDgUVsxGlsW R5Kq4w0a0Qkcze5387sEnZWA7056chvhil4uD3yLTXrTM1S/TBDprrL/8pN226n8gbtE5C rNFghC4ANnU/5G03HBxdC+mfZV7PBLu5/qyFDpk4Ukpp/3jVwnxAr95s+QoviKWehJs1gu YRd6DokXDlUJiSTyPPWKjESHfOUrlY5pjYMGNr0DMhbI2zhMoR/MbxPxSkvIntu3Ab5DwA IF4rJcGtqvClL6+AslcZQoDPhT4uRhuW5zwIlpVvLRXYQWGlGkxtNIZnbU2UAw== 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 4LxCXb5TXnzT2s; Mon, 1 Aug 2022 09:30:39 +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 2719UdkN040915; Mon, 1 Aug 2022 09:30:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2719Udax040914; Mon, 1 Aug 2022 09:30:39 GMT (envelope-from git) Date: Mon, 1 Aug 2022 09:30:39 GMT Message-Id: <202208010930.2719Udax040914@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: f28532a0f363 - main - tests: fix unix_passfd_dgram:rights_creds_payload after be1f485d7d6b 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: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f28532a0f363dd99691597708ae01331fb2c9a54 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659346239; 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=NupGH4CLmN2Elsc5BOLJdm+iyKu+inHRtPtEv9i7i/I=; b=KwsuxTVbZgl2YTrCkedVblzQ8sGpfvGnDbTUhAs8Db6MU8GzzK0SbejgRwBvLePP0vOBad L5dGHOwHq94UvFQhFAcDaPwNVX6wDiAAUkF6XwYtp3z7t0CLn+36f+gZjzYq3Z8dfjcgsw jXVOo5dN828CfT8IbnMxfUp8zTmGkwo3g7wESr3M0+T5fkG17W/uPw0D83gVTTsrjwZBgu XlFMoeG6nVTH+DhPPUv1OUA5Gq8QVU8ovnmJ8MX1OkQY8+1HfEY9zLVuOX30oHX31c4aDG uyiNFiWpfHl+/P0eR/ArgDhBWs27wIrHhN5l0Si37sMg06LcxcWzvjFdQO59Qg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659346239; a=rsa-sha256; cv=none; b=VMHkhmCabyDYj8TRJzAgjGaneYxmL5wuBkLuPWGzEkHMqh5D4CY5e7BiULhFXQamKsksqw YWEoXkkDCMoQDbH58dmSIth/pcLPxFCHAAW/BtbSPbN2dwVTcishDODIN7JrQ/hLZffUUK 8Kd5pu9tpMWn5r/fGIZ4SbzzoyYrVtlWSCpnOw2jZSzXItWygG+Sqz5MECX9S1EyUXT3YA AGI/74VG137+KjkL4KQan4EtfVk0Wb7SX7K6os0Sra0aOMqv2MS+PabAlGz1t/x9YZN9NL L2JFUWfbDsXSF9dvsqE/Vs/+jNqkmVcHZGLiBK1eVUEnHwGxezgS2S7N4ohGRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f28532a0f363dd99691597708ae01331fb2c9a54 commit f28532a0f363dd99691597708ae01331fb2c9a54 Author: Alexander V. Chernikov AuthorDate: 2022-08-01 09:20:45 +0000 Commit: Alexander V. Chernikov CommitDate: 2022-08-01 09:20:45 +0000 tests: fix unix_passfd_dgram:rights_creds_payload after be1f485d7d6b The test was failing due to the assert on lack of MSG_TRUNC flag in the output flags of recvmsg(). The code passed MSG_TRUNC, along with sufficient-size buffer to hold the message to-be-received to the recvmsg(), and expected MSG_TRUNC to be returned as well. This is not exactly correct as a) MSG_TRUNC was not even a supported recvmsg() flag before be1f485d7d6b and b) it violates POSIX, as POSIX states it should be set only "If a message is too long to fit in the supplied buffers,". The test was working before as the kernel copied input flags to the output flags. be1f485d7d6b changed that behaviour to clear MSG_TRUNC if it was present on the input. Fix the test by checking POSIX-defined behaviour. Discussed with: glebius --- tests/sys/kern/unix_passfd_test.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/sys/kern/unix_passfd_test.c b/tests/sys/kern/unix_passfd_test.c index dc017db4f1ce..49f4540bb9d0 100644 --- a/tests/sys/kern/unix_passfd_test.c +++ b/tests/sys/kern/unix_passfd_test.c @@ -255,9 +255,8 @@ recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, "recvmsg: did not receive single-fd message"); ATF_REQUIRE_MSG(!localcreds(sockfd) || foundcreds, "recvmsg: expected credentials were not received"); - if (recvmsg_flags & MSG_TRUNC) - ATF_REQUIRE_MSG(msghdr.msg_flags & MSG_TRUNC, - "recvmsg: expected MSG_TRUNC missing"); + ATF_REQUIRE_MSG((msghdr.msg_flags & MSG_TRUNC) == 0, + "recvmsg: MSG_TRUNC is set while buffer is sufficient"); } static void @@ -584,8 +583,7 @@ ATF_TC_BODY(rights_creds_payload, tc) ATF_REQUIRE_MSG((size_t)len == sendspace, "sendmsg: %zu bytes sent", len); recvfd_payload(fd[1], &getfd, buf, len, - CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)), - MSG_TRUNC); + CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)), 0); #endif close(putfd);