Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/include/sys socket(-1, SOCK_CLOEXEC, 0); followed by t...



details:   https://anonhg.NetBSD.org/src/rev/5416e8e7055a
branches:  trunk
changeset: 789731:5416e8e7055a
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Sep 05 12:22:10 2013 +0000

description:
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.

diffstat:

 tests/include/sys/t_socket.c |  19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r b67c9d6866a8 -r 5416e8e7055a tests/include/sys/t_socket.c
--- a/tests/include/sys/t_socket.c      Thu Sep 05 11:34:40 2013 +0000
+++ b/tests/include/sys/t_socket.c      Thu Sep 05 12:22:10 2013 +0000
@@ -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_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();
 }



Home | Main Index | Thread Index | Old Index