Module Name: src
Committed By: pooka
Date: Thu Sep 5 12:22:10 UTC 2013
Modified Files:
src/tests/include/sys: t_socket.c
Log Message:
socket(-1, SOCK_CLOEXEC, 0); followed by the process exiting (i.e.
fd slot does not get initiailized before fd_free()) cases a diagnostic
kernel panic.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/include/sys/t_socket.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/include/sys/t_socket.c
diff -u src/tests/include/sys/t_socket.c:1.1 src/tests/include/sys/t_socket.c:1.2
--- src/tests/include/sys/t_socket.c:1.1 Thu Jul 7 05:50:27 2011
+++ src/tests/include/sys/t_socket.c Thu Sep 5 12:22:10 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: t_socket.c,v 1.1 2011/07/07 05:50:27 jruoho Exp $ */
+/* $NetBSD: t_socket.c,v 1.2 2013/09/05 12:22:10 pooka Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -179,10 +179,27 @@ ATF_TC_BODY(cmsg_sendfd, tc)
atf_tc_fail("expected \"%s\", got \"%s\"", MAGICSTRING, buf);
}
+ATF_TC(sock_cloexec);
+ATF_TC_HEAD(sock_cloexec, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "SOCK_CLOEXEC kernel invariant failure");
+}
+
+ATF_TC_BODY(sock_cloexec, tc)
+{
+
+ rump_init();
+ rump_pub_lwproc_rfork(RUMP_RFFDG);
+ if (rump_sys_socket(-1, SOCK_CLOEXEC, 0) != -1)
+ atf_tc_fail("invalid socket parameters unexpectedly worked");
+ rump_pub_lwproc_releaselwp();
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, cmsg_sendfd);
ATF_TP_ADD_TC(tp, cmsg_sendfd_bounds);
+ ATF_TP_ADD_TC(tp, sock_cloexec);
return atf_no_error();
}