From owner-svn-src-all@freebsd.org Tue Sep 3 20:26:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C281D6C48; Tue, 3 Sep 2019 20:26:09 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46NJPX6ztPz4KSJ; Tue, 3 Sep 2019 20:26:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE9388795; Tue, 3 Sep 2019 20:26:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x83KQ8vK094995; Tue, 3 Sep 2019 20:26:08 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x83KQ8KR094994; Tue, 3 Sep 2019 20:26:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909032026.x83KQ8KR094994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Sep 2019 20:26:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r351794 - in stable: 11/tests/sys/posixshm 12/tests/sys/posixshm X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/tests/sys/posixshm 12/tests/sys/posixshm X-SVN-Commit-Revision: 351794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Sep 2019 20:26:09 -0000 Author: kevans Date: Tue Sep 3 20:26:08 2019 New Revision: 351794 URL: https://svnweb.freebsd.org/changeset/base/351794 Log: tests: shm_open(2): Verify FD_CLOEXEC Motivated by the fact that I'm messing around near the implementation and wanting to ensure this doesn't get messed up in the process. Modified: stable/11/tests/sys/posixshm/posixshm_test.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/tests/sys/posixshm/posixshm_test.c Directory Properties: stable/12/ (props changed) Modified: stable/11/tests/sys/posixshm/posixshm_test.c ============================================================================== --- stable/11/tests/sys/posixshm/posixshm_test.c Tue Sep 3 20:23:58 2019 (r351793) +++ stable/11/tests/sys/posixshm/posixshm_test.c Tue Sep 3 20:26:08 2019 (r351794) @@ -609,6 +609,27 @@ ATF_TC_BODY(shm_functionality_across_fork, tc) shm_unlink(test_path); } +ATF_TC_WITHOUT_HEAD(cloexec); +ATF_TC_BODY(cloexec, tc) +{ + int fd; + + gen_test_path(); + + /* shm_open(2) is required to set FD_CLOEXEC */ + fd = shm_open(SHM_ANON, O_RDWR, 0777); + ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno); + ATF_REQUIRE((fcntl(fd, F_GETFD) & FD_CLOEXEC) != 0); + close(fd); + + /* Also make sure that named shm is correct */ + fd = shm_open(test_path, O_CREAT | O_RDWR, 0600); + ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno); + ATF_REQUIRE((fcntl(fd, F_GETFD) & FD_CLOEXEC) != 0); + close(fd); +} + + ATF_TP_ADD_TCS(tp) { @@ -630,6 +651,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, unlink_bad_path_pointer); ATF_TP_ADD_TC(tp, unlink_path_too_long); ATF_TP_ADD_TC(tp, object_resize); + ATF_TP_ADD_TC(tp, cloexec); return (atf_no_error()); }