Module Name: src Committed By: martin Date: Tue Jul 16 17:29:18 UTC 2019
Modified Files: src/tests/fs/nfs: t_mountd.c src/tests/fs/union: t_pr.c src/tests/fs/vfs: t_full.c t_io.c t_ro.c src/tests/lib/libc/gen: t_ftok.c src/tests/lib/libc/stdio: t_fopen.c src/tests/lib/libc/sys: t_access.c t_mprotect.c t_stat.c t_write.c src/tests/rump/rumpkern/h_client: h_forkcli.c Log Message: PR misc/54382: whenever open(2) is called with O_CREAT, make sure to pass an open mode argument. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/fs/nfs/t_mountd.c cvs rdiff -u -r1.12 -r1.13 src/tests/fs/union/t_pr.c cvs rdiff -u -r1.10 -r1.11 src/tests/fs/vfs/t_full.c cvs rdiff -u -r1.17 -r1.18 src/tests/fs/vfs/t_io.c cvs rdiff -u -r1.6 -r1.7 src/tests/fs/vfs/t_ro.c cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/gen/t_ftok.c cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/stdio/t_fopen.c cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_access.c cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/sys/t_mprotect.c cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/sys/t_stat.c cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/sys/t_write.c cvs rdiff -u -r1.1 -r1.2 src/tests/rump/rumpkern/h_client/h_forkcli.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/fs/nfs/t_mountd.c diff -u src/tests/fs/nfs/t_mountd.c:1.6 src/tests/fs/nfs/t_mountd.c:1.7 --- src/tests/fs/nfs/t_mountd.c:1.6 Fri Jan 13 21:30:40 2017 +++ src/tests/fs/nfs/t_mountd.c Tue Jul 16 17:29:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_mountd.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ +/* $NetBSD: t_mountd.c,v 1.7 2019/07/16 17:29:17 martin Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ wrkwrkwrk(void *unused) rump_sys_chdir(FSTEST_MNTNAME); while (!quit) { - fd = rump_sys_open("file", O_RDWR | O_CREAT); + fd = rump_sys_open("file", O_RDWR | O_CREAT, 0600); if (fd == -1) { if (errno == EACCES) { fail++; Index: src/tests/fs/union/t_pr.c diff -u src/tests/fs/union/t_pr.c:1.12 src/tests/fs/union/t_pr.c:1.13 --- src/tests/fs/union/t_pr.c:1.12 Fri Apr 14 01:30:38 2017 +++ src/tests/fs/union/t_pr.c Tue Jul 16 17:29:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_pr.c,v 1.12 2017/04/14 01:30:38 riastradh Exp $ */ +/* $NetBSD: t_pr.c,v 1.13 2019/07/16 17:29:17 martin Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -186,7 +186,7 @@ ATF_TC_BODY(devnull1, tc) &unionargs, sizeof(unionargs)) == -1) atf_tc_fail_errno("union mount"); - fd = rump_sys_open("/mp/null", O_WRONLY | O_CREAT | O_TRUNC); + fd = rump_sys_open("/mp/null", O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd == -1) atf_tc_fail_errno("open"); @@ -220,7 +220,7 @@ ATF_TC_BODY(devnull2, tc) &unionargs, sizeof(unionargs)) == -1) atf_tc_fail_errno("union mount"); - fd = rump_sys_open("/mp/null", O_WRONLY | O_CREAT | O_APPEND); + fd = rump_sys_open("/mp/null", O_WRONLY | O_CREAT | O_APPEND, 0600); if (fd == -1) atf_tc_fail_errno("open"); Index: src/tests/fs/vfs/t_full.c diff -u src/tests/fs/vfs/t_full.c:1.10 src/tests/fs/vfs/t_full.c:1.11 --- src/tests/fs/vfs/t_full.c:1.10 Fri Nov 30 09:52:39 2018 +++ src/tests/fs/vfs/t_full.c Tue Jul 16 17:29:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_full.c,v 1.10 2018/11/30 09:52:39 hannken Exp $ */ +/* $NetBSD: t_full.c,v 1.11 2019/07/16 17:29:17 martin Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ fillfs(const atf_tc_t *tc, const char *m if (rump_sys_chdir(mp) == -1) atf_tc_fail_errno("chdir mountpoint"); - fd = rump_sys_open("afile", O_CREAT | O_RDWR); + fd = rump_sys_open("afile", O_CREAT | O_RDWR, 0600); if (fd == -1) atf_tc_fail_errno("create file"); Index: src/tests/fs/vfs/t_io.c diff -u src/tests/fs/vfs/t_io.c:1.17 src/tests/fs/vfs/t_io.c:1.18 --- src/tests/fs/vfs/t_io.c:1.17 Fri Jan 13 21:30:40 2017 +++ src/tests/fs/vfs/t_io.c Tue Jul 16 17:29:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_io.c,v 1.17 2017/01/13 21:30:40 christos Exp $ */ +/* $NetBSD: t_io.c,v 1.18 2019/07/16 17:29:17 martin Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -85,7 +85,7 @@ extendbody(const atf_tc_t *tc, off_t see FSTEST_ENTER(); RL(fd = rump_sys_open("testfile", - O_CREAT | O_RDWR | (seekcnt ? O_APPEND : 0))); + O_CREAT | O_RDWR | (seekcnt ? O_APPEND : 0)), 0600); RL(rump_sys_ftruncate(fd, seekcnt)); RL(rump_sys_fstat(fd, &sb)); ATF_REQUIRE_EQ(sb.st_size, seekcnt); Index: src/tests/fs/vfs/t_ro.c diff -u src/tests/fs/vfs/t_ro.c:1.6 src/tests/fs/vfs/t_ro.c:1.7 --- src/tests/fs/vfs/t_ro.c:1.6 Fri Jan 13 21:30:40 2017 +++ src/tests/fs/vfs/t_ro.c Tue Jul 16 17:29:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ro.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ +/* $NetBSD: t_ro.c,v 1.7 2019/07/16 17:29:17 martin Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -79,7 +79,8 @@ create(const atf_tc_t *tc, const char *m { FSTEST_ENTER(); - ATF_REQUIRE_ERRNO(EROFS, rump_sys_open(AFILE, O_CREAT|O_RDONLY) == -1); + ATF_REQUIRE_ERRNO(EROFS, rump_sys_open(AFILE, O_CREAT|O_RDONLY, + 0600) == -1); FSTEST_EXIT(); } Index: src/tests/lib/libc/gen/t_ftok.c diff -u src/tests/lib/libc/gen/t_ftok.c:1.2 src/tests/lib/libc/gen/t_ftok.c:1.3 --- src/tests/lib/libc/gen/t_ftok.c:1.2 Tue Jan 10 15:19:52 2017 +++ src/tests/lib/libc/gen/t_ftok.c Tue Jul 16 17:29:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ftok.c,v 1.2 2017/01/10 15:19:52 christos Exp $ */ +/* $NetBSD: t_ftok.c,v 1.3 2019/07/16 17:29:18 martin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_ftok.c,v 1.2 2017/01/10 15:19:52 christos Exp $"); +__RCSID("$NetBSD: t_ftok.c,v 1.3 2019/07/16 17:29:18 martin Exp $"); #include <sys/types.h> #include <sys/ipc.h> @@ -65,7 +65,7 @@ ATF_TC_BODY(ftok_link, tc) key_t k1, k2, k3; int fd; - fd = open(path, O_RDONLY | O_CREAT); + fd = open(path, O_RDONLY | O_CREAT, 0600); ATF_REQUIRE(fd >= 0); (void)close(fd); Index: src/tests/lib/libc/stdio/t_fopen.c diff -u src/tests/lib/libc/stdio/t_fopen.c:1.6 src/tests/lib/libc/stdio/t_fopen.c:1.7 --- src/tests/lib/libc/stdio/t_fopen.c:1.6 Tue Feb 5 17:30:19 2019 +++ src/tests/lib/libc/stdio/t_fopen.c Tue Jul 16 17:29:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_fopen.c,v 1.6 2019/02/05 17:30:19 kamil Exp $ */ +/* $NetBSD: t_fopen.c,v 1.7 2019/07/16 17:29:18 martin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_fopen.c,v 1.6 2019/02/05 17:30:19 kamil Exp $"); +__RCSID("$NetBSD: t_fopen.c,v 1.7 2019/07/16 17:29:18 martin Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -62,7 +62,7 @@ ATF_TC_BODY(fdopen_close, tc) * used to fdopen(3) a stream is * closed once the stream is closed. */ - fd = open(path, O_RDWR | O_CREAT); + fd = open(path, O_RDWR | O_CREAT, 0600); ATF_REQUIRE(fd >= 0); @@ -89,7 +89,7 @@ ATF_TC_BODY(fdopen_err, tc) { int fd; - fd = open(path, O_RDONLY | O_CREAT); + fd = open(path, O_RDONLY | O_CREAT, 0600); ATF_REQUIRE(fd >= 0); errno = 0; @@ -130,7 +130,7 @@ ATF_TC_BODY(fdopen_seek, tc) * with the stream corresponds with the offset * set earlier for the file descriptor. */ - fd = open(path, O_RDWR | O_CREAT); + fd = open(path, O_RDWR | O_CREAT, 0600); ATF_REQUIRE(fd >= 0); ATF_REQUIRE(write(fd, "garbage", 7) == 7); Index: src/tests/lib/libc/sys/t_access.c diff -u src/tests/lib/libc/sys/t_access.c:1.2 src/tests/lib/libc/sys/t_access.c:1.3 --- src/tests/lib/libc/sys/t_access.c:1.2 Tue Jan 10 22:36:29 2017 +++ src/tests/lib/libc/sys/t_access.c Tue Jul 16 17:29:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */ +/* $NetBSD: t_access.c,v 1.3 2019/07/16 17:29:18 martin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $"); +__RCSID("$NetBSD: t_access.c,v 1.3 2019/07/16 17:29:18 martin Exp $"); #include <atf-c.h> @@ -58,7 +58,7 @@ ATF_TC_BODY(access_access, tc) size_t i; int fd; - fd = open(path, O_RDONLY | O_CREAT); + fd = open(path, O_RDONLY | O_CREAT, 0600); if (fd < 0) return; Index: src/tests/lib/libc/sys/t_mprotect.c diff -u src/tests/lib/libc/sys/t_mprotect.c:1.7 src/tests/lib/libc/sys/t_mprotect.c:1.8 --- src/tests/lib/libc/sys/t_mprotect.c:1.7 Sat May 6 21:34:52 2017 +++ src/tests/lib/libc/sys/t_mprotect.c Tue Jul 16 17:29:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_mprotect.c,v 1.7 2017/05/06 21:34:52 joerg Exp $ */ +/* $NetBSD: t_mprotect.c,v 1.8 2019/07/16 17:29:18 martin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_mprotect.c,v 1.7 2017/05/06 21:34:52 joerg Exp $"); +__RCSID("$NetBSD: t_mprotect.c,v 1.8 2019/07/16 17:29:18 martin Exp $"); #include <sys/param.h> #include <sys/mman.h> @@ -87,7 +87,7 @@ ATF_TC_BODY(mprotect_access, tc) size_t i; int fd; - fd = open(path, O_RDONLY | O_CREAT); + fd = open(path, O_RDONLY | O_CREAT, 0600); ATF_REQUIRE(fd >= 0); /* Index: src/tests/lib/libc/sys/t_stat.c diff -u src/tests/lib/libc/sys/t_stat.c:1.5 src/tests/lib/libc/sys/t_stat.c:1.6 --- src/tests/lib/libc/sys/t_stat.c:1.5 Fri Jan 13 20:06:50 2017 +++ src/tests/lib/libc/sys/t_stat.c Tue Jul 16 17:29:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $ */ +/* $NetBSD: t_stat.c,v 1.6 2019/07/16 17:29:18 martin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $"); +__RCSID("$NetBSD: t_stat.c,v 1.6 2019/07/16 17:29:18 martin Exp $"); #include <sys/stat.h> #include <sys/socket.h> @@ -64,7 +64,7 @@ ATF_TC_BODY(stat_chflags, tc) (void)memset(&sa, 0, sizeof(struct stat)); (void)memset(&sb, 0, sizeof(struct stat)); - fd = open(path, O_RDONLY | O_CREAT); + fd = open(path, O_RDONLY | O_CREAT, 0600); ATF_REQUIRE(fd != -1); ATF_REQUIRE(stat(path, &sa) == 0); @@ -210,7 +210,7 @@ ATF_TC_BODY(stat_mtime, tc) (void)memset(&sa, 0, sizeof(struct stat)); (void)memset(&sb, 0, sizeof(struct stat)); - fd[i] = open(path, O_WRONLY | O_CREAT); + fd[i] = open(path, O_WRONLY | O_CREAT, 0600); ATF_REQUIRE(fd[i] != -1); ATF_REQUIRE(write(fd[i], "X", 1) == 1); @@ -254,7 +254,7 @@ ATF_TC_BODY(stat_perm, tc) uid = getuid(); gid = getgid(); - fd = open(path, O_RDONLY | O_CREAT); + fd = open(path, O_RDONLY | O_CREAT, 0600); ATF_REQUIRE(fd != -1); ATF_REQUIRE(fstat(fd, &sa) == 0); @@ -288,7 +288,7 @@ ATF_TC_BODY(stat_size, tc) size_t i; int fd; - fd = open(path, O_WRONLY | O_CREAT); + fd = open(path, O_WRONLY | O_CREAT, 0600); ATF_REQUIRE(fd >= 0); for (i = 0; i < n; i++) { @@ -377,7 +377,7 @@ ATF_TC_BODY(stat_symlink, tc) (void)memset(&sa, 0, sizeof(struct stat)); (void)memset(&sb, 0, sizeof(struct stat)); - fd = open(path, O_WRONLY | O_CREAT); + fd = open(path, O_WRONLY | O_CREAT, 0600); ATF_REQUIRE(fd >= 0); ATF_REQUIRE(symlink(path, pathlink) == 0); Index: src/tests/lib/libc/sys/t_write.c diff -u src/tests/lib/libc/sys/t_write.c:1.6 src/tests/lib/libc/sys/t_write.c:1.7 --- src/tests/lib/libc/sys/t_write.c:1.6 Sun Jul 9 22:18:43 2017 +++ src/tests/lib/libc/sys/t_write.c Tue Jul 16 17:29:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_write.c,v 1.6 2017/07/09 22:18:43 christos Exp $ */ +/* $NetBSD: t_write.c,v 1.7 2019/07/16 17:29:18 martin Exp $ */ /*- * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include <sys/cdefs.h> __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_write.c,v 1.6 2017/07/09 22:18:43 christos Exp $"); +__RCSID("$NetBSD: t_write.c,v 1.7 2019/07/16 17:29:18 martin Exp $"); #include <sys/uio.h> #include <sys/mman.h> @@ -71,7 +71,7 @@ ATF_TC_BODY(write_err, tc) errno = 0; ATF_REQUIRE_ERRNO(EBADF, write(-1, wbuf, sizeof(wbuf)) == -1); - fd = open(path, O_RDWR | O_CREAT); + fd = open(path, O_RDWR | O_CREAT, 0600); if (fd >= 0) { @@ -143,7 +143,7 @@ ATF_TC_BODY(write_pos, tc) size_t i; int fd; - fd = open(path, O_RDWR | O_CREAT); + fd = open(path, O_RDWR | O_CREAT, 0600); ATF_REQUIRE(fd >= 0); for (i = 0; i < n; i++) { @@ -173,7 +173,7 @@ ATF_TC_BODY(write_ret, tc) size_t i, j; int fd; - fd = open(path, O_WRONLY | O_CREAT); + fd = open(path, O_WRONLY | O_CREAT, 0600); ATF_REQUIRE(fd >= 0); (void)memset(buf, 'x', sizeof(buf)); Index: src/tests/rump/rumpkern/h_client/h_forkcli.c diff -u src/tests/rump/rumpkern/h_client/h_forkcli.c:1.1 src/tests/rump/rumpkern/h_client/h_forkcli.c:1.2 --- src/tests/rump/rumpkern/h_client/h_forkcli.c:1.1 Wed Jan 5 17:19:09 2011 +++ src/tests/rump/rumpkern/h_client/h_forkcli.c Tue Jul 16 17:29:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: h_forkcli.c,v 1.1 2011/01/05 17:19:09 pooka Exp $ */ +/* $NetBSD: h_forkcli.c,v 1.2 2019/07/16 17:29:18 martin Exp $ */ #include <sys/types.h> #include <sys/wait.h> @@ -24,7 +24,7 @@ simple(void) if ((pid1 = rump_sys_getpid()) < 2) errx(1, "unexpected pid %d", pid1); - fd = rump_sys_open("/dev/null", O_CREAT | O_RDWR); + fd = rump_sys_open("/dev/null", O_CREAT | O_RDWR, 0600); if (rump_sys_write(fd, &fd, sizeof(fd)) != sizeof(fd)) errx(1, "write newlyopened /dev/null");