opnsense-src/tests/sys/vm
Mark Johnston 3bb4da789a device_pager: Avoid double-insertion of pages into the pager list
Unmanaged device pager objects maintain a linked list of pages that were
returned from the fault handler.  Initially, such pages are valid, but
msync(MS_INVALIDATE) can mark them invalid (and clean).  They are not
removed from page tables (since they are unmanaged), but a subsequent
mlock() call can trigger a page fault that is handled by the pager.
dev_pager_getpages() then re-inserts the page into the linked list even
though it's already present there.

This patch fixes the problem by removing the linked list.  OBJ_PG_DTOR
is set, so vm_object_terminate_pages() does nothing, and
dev_pager_dealloc() instead handles cleanup of the object.

Add a regression test case which triggers a queue.h assertion failure in
unpatched kernels.

Note, in stable branches we should avoid changing the layout of struct
vm_object.

Approved by:	so
Security:	FreeBSD-SA-26:37.vm
Security:	CVE-2026-49418
Reported by:	slidybat
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57743
2026-06-30 23:16:24 +02:00
..
soxstack Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
stack tests: Handle SIGSEGV in the vm stack mprotect exec test 2023-08-24 21:02:52 +03:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
mlock_test.c mlock tests: Add a regression test 2023-10-02 08:55:49 -04:00
mmap_map_32bit_helper.c vm: Allow MAP_32BIT for all architectures 2023-08-14 20:20:20 +03:00
mmap_map_32bit_test.sh tests: Add MAP_32BIT flag test 2023-08-01 23:23:15 +03:00
mmap_test.c device_pager: Avoid double-insertion of pages into the pager list 2026-06-30 23:16:24 +02:00
page_fault_signal.c Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
shared_shadow_inval_test.c shared_shadow_inval_test: fix copy-pasto in error message 2022-08-24 13:03:11 -05:00