opnsense-src/sys/vm
Mark Johnston 6c203aa76c posixshm: Fix handling of sendfile() with largepage objects
sendfile(2) can transmit POSIX shared memory objects.  Typically it will
look up and wire each page before sending it to a socket; once
transmission is complete, the page is unwired and typically released
back into the page queues.  sendfile() has an advisory flag, SF_NOCACHE,
which means, "try to free the page once transmission is complete."  This
is implemented in vm_page_release(), which expects to operate on managed
pages.

Pages belonging a largepage object are de-facto wired not explicitly so.
Thus, vm_page_release() will unwire and, having found no additional
references, free the page.  Because mappings of largepage objects are
unmanaged, userspace can still access the now freed page.

Fix the problem by explicitly wiring largepage pages.  Make the VM
object destructor responsible for unwiring and freeing them.

Add a regression test.

Approved by:	so
Security:	FreeBSD-SA-26:44.posixshm
Security:	CVE-2026-49427
Reported by:	Chris Jarrett-Davies <chrisjd@openai.com>
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57832
2026-07-06 10:29:39 +02:00
..
_vm_phys.h
_vm_radix.h
device_pager.c device_pager: Avoid double-insertion of pages into the pager list 2026-07-06 10:29:21 +02:00
memguard.c
memguard.h
phys_pager.c vm_page: drop mpred param from insert_lookup 2025-05-07 16:40:51 -05:00
pmap.h pmap_growkernel(): do not panic immediately, optionally return the error 2025-06-20 01:25:56 +03:00
redzone.c
redzone.h
sg_pager.c Add sysctl kern.proc.kqueue 2025-03-13 18:09:35 +02:00
swap_pager.c vm/swap_pager.c: silence compiler warning 2026-01-24 02:26:45 +02:00
swap_pager.h vm_pageout: Scan inactive dirty pages less aggressively 2025-08-01 20:15:28 +00:00
uma.h Introduce the UMA_ZONE_NOTRIM uma zone type 2025-01-15 12:23:00 -05:00
uma_align_mask.h
uma_core.c uma_core: Rely on domainset iterator to wait on M_WAITOK 2026-01-06 14:33:23 +01:00
uma_dbg.c
uma_dbg.h
uma_int.h
vm.h rfork(2): fix swap accounting in vmspace_unshare() 2026-01-24 02:26:45 +02:00
vm_domainset.c vm_domainset: Ensure round-robin works properly 2025-10-20 16:47:37 +00:00
vm_domainset.h vm_domainset: Refactor iterators, multiple fixes 2025-09-19 12:07:04 +02:00
vm_dumpset.h
vm_extern.h vm_page_free_prep(): convert PG_ZERO zeroed page check to use sf_buf 2025-11-28 02:44:15 +02:00
vm_fault.c vm_fault: Reset m_needs_zeroing properly 2026-04-13 10:57:26 +00:00
vm_glue.c vm: Fix kstack alignment assertion 2025-12-19 18:05:43 +00:00
vm_init.c sys: do not allow entering vm_fault() on boot until VM is initialized 2026-01-25 02:23:35 +02:00
vm_kern.c linker: Reset DMAP protections in link_elf_unload_file() 2026-01-27 14:10:48 +00:00
vm_kern.h
vm_map.c pkru: Fix handling of 1GB largepage mappings 2026-04-21 15:42:41 +00:00
vm_map.h pkru: Fix handling of 1GB largepage mappings 2026-04-21 15:42:41 +00:00
vm_meter.c vm: Use proper prototype for SYSINIT functions 2026-02-01 01:01:07 +08:00
vm_mmap.c Provide more precise error explanations for mmap(2) EINVAL errors. 2026-03-25 22:43:25 -07:00
vm_object.c vm_object: remove the charge member 2026-01-24 02:26:45 +02:00
vm_object.h device_pager: Avoid double-insertion of pages into the pager list 2026-07-06 10:29:21 +02:00
vm_page.c posixshm: Fix handling of sendfile() with largepage objects 2026-07-06 10:29:39 +02:00
vm_page.h vm_page.h: Materialize a spare bit 2026-03-05 15:43:25 +01:00
vm_pageout.c vm: Use proper prototype for SYSINIT functions 2026-02-01 01:01:07 +08:00
vm_pageout.h vm_pageout: reduce number of flush() params 2025-05-30 16:07:39 -05:00
vm_pagequeue.h vm_pageout: Remove a volatile qualifier from some vm_domain members 2025-07-15 15:16:40 +00:00
vm_pager.c
vm_pager.h device_pager: Add cdev_pager_get_path to retrieve the "path" for an object 2025-03-27 16:44:33 -04:00
vm_param.h vm: retire vm_page_lock() 2025-06-11 15:19:41 -05:00
vm_phys.c vm_page: Retire its listq field 2025-06-08 13:35:56 -05:00
vm_phys.h vm_phys: reduce touching of page->pool fields 2025-01-29 03:13:17 -06:00
vm_radix.c
vm_radix.h vm_page_grab_pages: fetch page ranges 2025-05-08 22:51:58 -05:00
vm_reserv.c vm_page: drop mpred param from insert_lookup 2025-05-07 16:40:51 -05:00
vm_reserv.h vm_page: drop mpred param from insert_lookup 2025-05-07 16:40:51 -05:00
vm_swapout.c vm_swapout: use VM_RADIX_FOREACH 2025-04-18 14:48:55 -05:00
vm_unix.c
vnode_pager.c sys: Remove/update references to the swapper process in various comments 2025-12-19 10:19:44 -05:00
vnode_pager.h