aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2026-11-13 00:46:50 +0000
committerMark Johnston <markj@FreeBSD.org>2026-11-15 15:40:22 +0000
commitde97544ca485fb64c44e45836b5c4022a1c04bdb (patch)
tree63f74fb1d73e1bfcdf66335f1b1f6999ec34d8bb /sys/dev/netmap
parentacf5bc2b6b8b7a75f81466bd1d6a7ff5bef2db6f (diff)
tests: Add test for vn_io_fault1 bug
This bug was fixed in b487aca48535, but I did not have a regression test ready for it at the time. The test allocates a large buffer, faults part of it in and leaves the rest unmapped, then tries to read a 3 GiB file into it. If the bug is present, the read succeeds, but the return value exceeds the requested amount by exactly one page less than the amount that was prefaulted. Approved by: so Security: FreeBSD-EN-26:30.vfs PR: 298159 MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D61475 (cherry picked from commit ba02bbbe86aeca0c95c8e7d12c1be357ebb3ddeb) tests: Improve vn_io_fault1 test * Declare that the test needs 4 GB of memory so it can be automatically skipped on systems with low memory. * Switch back to mmap() as in my initial prototype. Using malloc() is simpler, but on systems with malloc debugging enabled, malloc() will prefault the entire buffer, resulting in a false positive. Using mmap() also guarantees that the buffer is page-aligned, which renders the test determinstic: we now only need to prefault exactly 2 GB, and the difference between ret and len will be exactly the amount that we prefaulted. * To prefault the buffer, instead of a simple loop that writes zeroes to it, which a compiler might recognize as dead stores and eliminate, read the first INT_MAX bytes from the file into it. PR: 298159 Fixes: ba02bbbe86ae ("tests: Add test for vn_io_fault1 bug") Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D61508 (cherry picked from commit c5cff3df96c35aa3613c083f151e853b532d88cb) (cherry picked from commit 488e9144c154904391fb224dfce0095e9edff0e6)
Diffstat (limited to 'sys/dev/netmap')
0 files changed, 0 insertions, 0 deletions