summaryrefslogtreecommitdiff
path: root/tests/kernel
diff options
context:
space:
mode:
authorpooka <pooka@NetBSD.org>2010-12-04 17:38:42 +0000
committerpooka <pooka@NetBSD.org>2010-12-04 17:38:42 +0000
commitf642190056ffc10b60ec6a60b845f683378df7fd (patch)
tree31cc6ce0f35c586100263d04794cbf5d27ccd564 /tests/kernel
parentdd4fc4962189434051e578dc5e2910bce7f2a101 (diff)
Add test case for suspected reason behind kernel panic described
in PR kern/44190
Diffstat (limited to 'tests/kernel')
-rw-r--r--tests/kernel/t_rnd.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/kernel/t_rnd.c b/tests/kernel/t_rnd.c
index 8b8cfa7fcc8..c98393a2bb7 100644
--- a/tests/kernel/t_rnd.c
+++ b/tests/kernel/t_rnd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_rnd.c,v 1.1 2009/09/08 20:37:45 pooka Exp $ */
+/* $NetBSD: t_rnd.c,v 1.2 2010/12/04 17:38:42 pooka Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_rnd.c,v 1.1 2009/09/08 20:37:45 pooka Exp $");
+__RCSID("$NetBSD: t_rnd.c,v 1.2 2010/12/04 17:38:42 pooka Exp $");
#include <sys/types.h>
#include <sys/fcntl.h>
@@ -64,9 +64,32 @@ ATF_TC_BODY(RNDADDDATA, tc)
atf_tc_fail_errno("RNDADDDATA");
}
+ATF_TC(RNDADDDATA2);
+ATF_TC_HEAD(RNDADDDATA2, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "checks ioctl(RNDADDDATA) deals with "
+ "garbage len field");
+}
+ATF_TC_BODY(RNDADDDATA2, tc)
+{
+ rnddata_t rd;
+ int fd;
+
+ rump_init();
+ fd = rump_sys_open("/dev/random", O_RDWR, 0);
+ if (fd == -1)
+ atf_tc_fail_errno("cannot open /dev/random");
+
+ rd.entropy = 1;
+ rd.len = -1;
+ atf_tc_expect_signal(-1, "PR kern/44190");
+ ATF_REQUIRE_ERRNO(E2BIG, rump_sys_ioctl(fd, RNDADDDATA, &rd) == -1);
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, RNDADDDATA);
+ ATF_TP_ADD_TC(tp, RNDADDDATA2);
return atf_no_error();
}