Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177525465
D61475.1794628108.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61475.1794628108.diff
View Options
diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile
--- a/tests/sys/kern/Makefile
+++ b/tests/sys/kern/Makefile
@@ -82,6 +82,9 @@
ATF_TESTS_C+= pdeathsig
ATF_TESTS_C+= sigsys
TEST_METADATA.sigsys+= is_exclusive="true"
+.if ${MACHINE_ARCH:M*64*}
+ATF_TESTS_C+= vn_io_fault1
+.endif
ATF_TESTS_SH+= coredump_phnum_test
ATF_TESTS_SH+= logsigexit_test
diff --git a/tests/sys/kern/vn_io_fault1.c b/tests/sys/kern/vn_io_fault1.c
new file mode 100644
--- /dev/null
+++ b/tests/sys/kern/vn_io_fault1.c
@@ -0,0 +1,56 @@
+/*-
+ * Copyright (c) 2026 Dag-Erling Smørgrav
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <atf-c.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+ATF_TC(big_unmapped_read);
+ATF_TC_HEAD(big_unmapped_read, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Read a large amount of data "
+ "into a partially unmapped buffer");
+}
+ATF_TC_BODY(big_unmapped_read, tc)
+{
+ char *buf;
+ size_t len = 3LU << 30;
+ ssize_t ret;
+ int fd;
+
+ /* allocate a large buffer */
+ if ((buf = malloc(len)) == NULL)
+ atf_tc_skip("failed to allocate buffer");
+
+ /* fault in just a tad more than the first 2 GB */
+ for (size_t i = 0; i <= 2LU << 30; i += 4096)
+ buf[i] = 0;
+
+ /* create a large file */
+ fd = open("big", O_RDWR | O_CREAT | O_TRUNC, 0600);
+ ATF_REQUIRE(fd >= 0);
+ ATF_REQUIRE_EQ_MSG(0, ftruncate(fd, len),
+ "failed to extend file: %m");
+
+ /* read the file into the buffer */
+ ret = read(fd, buf, len);
+ ATF_REQUIRE_MSG(ret >= 0,
+ "failed to read from file: %m");
+ ATF_REQUIRE_EQ_MSG(len, (size_t)ret,
+ "requested %zu bytes, got %zd", len, ret);
+
+ /* done */
+ ATF_CHECK_EQ(0, close(fd));
+ free(buf);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, big_unmapped_read);
+ return (atf_no_error());
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 3:48 AM (18 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41714185
Default Alt Text
D61475.1794628108.diff (1 KB)
Attached To
Mode
D61475: tests: Add test for vn_io_fault1 bug
Attached
Detach File
Event Timeline