From nobody Wed Feb 28 22:33:07 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 4TlTdb4FpBz5CXVS; Wed, 28 Feb 2024 22:33: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 4TlTdb3RtRz4pcY; Wed, 28 Feb 2024 22:33:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709159587; 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=XqDAkahlxRNV8XmVNWJJ7bizh1zL7oZzR7hiUW3e2gI=; b=BGlXwE/vG7yDmbsgy3wb3n+Nytm9wx63nCVVfq8XXzUdjcIWMbGhtk4X4TBuauaJPiN245 BNJQ97L4OuCz5NiRxKcOeGeQ7Nqt1DU6r30idWXMWV0zoFjUqLEFtiwlKaZWlkr5sUbvfC ZZCrPTBdIQOzp+v24TlscXqQNp7+KBN00Qq8ea+J68qjk/rHGlKnD0WAyZzWExOnO57yKH eoo6uUFWcWLgm1nashhXJpK7JlXZdhmip18UzKEabcctz1aX8o57b6qgm8YsVRvdVfKAs6 onFxZ2UI4YZSnxi9rTquPHlHyCHmrRmT3g2usumeaygjjIu4Tj4BqMU+FDDcaw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709159587; a=rsa-sha256; cv=none; b=jN5wk6uBzd6+KdH33sflaZW7Hp16VUnjNHqHohuS3EPIdbRV8VxBAHAi8UvIrNoYoBx3U1 y0pnPKsQRJSELDN35I5o5htstskEmUUodKjkN4uTiZgBZ1J8PGmxuitMIWR6RyeaHkn7Tv 2GeidmwVqhhfaMOghAu++cpEtBXM0/2aJ2jPlQPu4oNXUurKFIlhked/Jv+q3BThNekQo4 8DBidwAjwqVX+3ruuLnK6OKScG8cu60sFacT+AEKJ1Y48j3hCJDZCSgT8yNAH42eVu8ADG dGswMIIGVMNvWqm19zT8xVgMVX2FZtdI5FXPKr7CRjipGClnXF0JHMoLZeTqbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709159587; 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=XqDAkahlxRNV8XmVNWJJ7bizh1zL7oZzR7hiUW3e2gI=; b=gx0uT/U7+/6pMiWVCYSUf7pVBYeZJjBbvrdOQr9myhRxfg9sESaCSI9ccBP+TUQjAaMOLC 2nG9RWA/VqWqevhL3+g2/+t/AvwE1n+WVQuXf8nbH/fmFQOe18w6u4EiBPG+tPHLIoP+SJ ubyBKyLqV6ihsKN3pL8M8VWQDYfvdEatZ9bR1eq0IO6iHroiy+ujcwF8GTjVILXoxoSSH/ tgx8Y2ve2bQ2Az/Th/TQGfbEnQrg8m0JF0qXFzD/TDxPOz8rkZUQebhhvbYZ7ICTgGKtBl QiMk2NhK97O3cLv5x/3e6xls+XrKLLV9IjDoR8E8B8FUk+HW8bDvmf2GJZA4bQ== 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 4TlTdb33D1zGDp; Wed, 28 Feb 2024 22:33:07 +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 41SMX74t010846; Wed, 28 Feb 2024 22:33:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41SMX7jv010843; Wed, 28 Feb 2024 22:33:07 GMT (envelope-from git) Date: Wed, 28 Feb 2024 22:33:07 GMT Message-Id: <202402282233.41SMX7jv010843@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: 152a6d410e47 - main - socket tests: remove MSG_TRUNC test for unix/seqpacket 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: 152a6d410e47a818fae905f6f4bd43f422146802 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=152a6d410e47a818fae905f6f4bd43f422146802 commit 152a6d410e47a818fae905f6f4bd43f422146802 Author: Gleb Smirnoff AuthorDate: 2024-02-28 22:32:46 +0000 Commit: Gleb Smirnoff CommitDate: 2024-02-28 22:32:46 +0000 socket tests: remove MSG_TRUNC test for unix/seqpacket The PF_UNIX/SOCK_SEQPACKET was marked as PR_ATOMIC and that made soreceive_generic() to treat it pretty much as a datagram socket. However, POSIX says: The SOCK_SEQPACKET socket type is similar to the SOCK_STREAM type, and is also connection-oriented. The only difference between these types is that record boundaries are maintained using the SOCK_SEQPACKET type. A record can be sent using one or more output operations and received using one or more input operations, but a single operation never transfers parts of more than one record. Record boundaries are visible to the receiver via the MSG_EOR flag in the received message flags returned by the recvmsg() function. It is protocol-specific whether a maximum record size is imposed. What the test was doing is checking if MSG_TRUNC would report the space required to return up the end of next mbuf record in the socket buffer. Apparently the test assumed that this boundary is defined by the write(2) size on the peer socket. This was true in test conditions, but I'm not sure it would always be true - sbcompress() may merge mbufs. Anyway, the mbuf boundaries are internal socket buffer implementation, they are not SOCK_SEQPACKET records. The records need to be explicitly marked with MSG_EOR by sender, and the test definitely wasn't doing that. Reviewed by: tuexen, markj Differential Revision: https://reviews.freebsd.org/D43707 --- tests/sys/kern/socket_msg_trunc.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/tests/sys/kern/socket_msg_trunc.c b/tests/sys/kern/socket_msg_trunc.c index b0ea724f0de0..bf1f0bf8ff42 100644 --- a/tests/sys/kern/socket_msg_trunc.c +++ b/tests/sys/kern/socket_msg_trunc.c @@ -153,39 +153,6 @@ ATF_TC_BODY(recv_trunc_afunix_dgram, tc) check_recvmsg(cs, ss, sa, sizes, nitems(sizes)); } -ATF_TC_WITHOUT_HEAD(recv_trunc_afunix_seqpacket); -ATF_TC_BODY(recv_trunc_afunix_seqpacket, tc) -{ - struct sockaddr_un sun; - struct sockaddr *sa; - int ss, nss, cs, rc; - - ss = socket(PF_UNIX, SOCK_SEQPACKET, 0); - ATF_REQUIRE(ss >= 0); - - bzero(&sun, sizeof(sun)); - sun.sun_family = AF_UNIX; - strlcpy(sun.sun_path, "test_check_recvmsg_socket", sizeof(sun.sun_path)); - sun.sun_len = sizeof(sun); - sa = (struct sockaddr *)&sun; - rc = bind(ss, sa, sa->sa_len); - ATF_REQUIRE_MSG(rc == 0, "bind failed: %s", strerror(errno)); - rc = listen(ss, 1); - ATF_REQUIRE_MSG(rc == 0, "listen failed: %s", strerror(errno)); - - cs = socket(PF_UNIX, SOCK_SEQPACKET, 0); - ATF_REQUIRE(cs >= 0); - rc = connect(cs, sa, sa->sa_len); - ATF_REQUIRE_MSG(rc == 0, "connect failed: %s", strerror(errno)); - nss = accept(ss, NULL, NULL); - ATF_REQUIRE(nss >= 0); - - size_t sizes[] = {80, 255, 256, 1024, 2000}; - check_recvmsg(cs, nss, sa, sizes, nitems(sizes)); - - ATF_REQUIRE(close(ss) == 0); -} - /* * Exercise the case where ktrace was used to dump a truncated buffer. */ @@ -245,7 +212,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, recv_trunc_afinet_udp); ATF_TP_ADD_TC(tp, recv_trunc_afinet6_udp); ATF_TP_ADD_TC(tp, recv_trunc_afunix_dgram); - ATF_TP_ADD_TC(tp, recv_trunc_afunix_seqpacket); ATF_TP_ADD_TC(tp, recvmsg_trunc_ktrace_uio); return (atf_no_error());