opnsense-src/sys
Mark Johnston 0fc6eebbf7 vm_fault: Fix vm_fault_populate()'s handling of VM_FAULT_WIRE
vm_map_wire() works by calling vm_fault(VM_FAULT_WIRE) on each page in
the rage.  (For largepage mappings, it calls vm_fault() once per large
page.)

A pager's populate method may return more than one page to be mapped.
If VM_FAULT_WIRE is also specified, we'd wire each page in the run, not
just the fault page.  Consider an object with two pages mapped in a
vm_map_entry, and suppose vm_map_wire() is called on the entry.  Then,
the first vm_fault() would allocate and wire both pages, and the second
would encounter a valid page upon lookup and wire it again in the
regular fault handler.  So the second page is wired twice and will be
leaked when the object is destroyed.

Fix the problem by modify vm_fault_populate() to wire only the fault
page.  Also modify the error handler for pmap_enter(psind=1) to not test
fs->wired, since it must be false.

PR:		260347
Reviewed by:	alc, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 88642d978a)
2021-12-27 19:36:07 -05:00
..
amd64 Clean up a couple of MD warts in vm_fault_populate(): 2021-12-27 19:35:55 -05:00
arm busdma: Remove outdated comments about Giant. 2021-12-23 20:05:17 -05:00
arm64 busdma: Remove outdated comments about Giant. 2021-12-23 20:05:17 -05:00
bsm Add aio_writev and aio_readv 2021-01-02 19:57:58 -07:00
cam mmc_sim: fix setting of the mutex name 2021-12-25 11:04:29 +02:00
cddl dtrace: Disable getf() as it is broken on FreeBSD 2021-12-26 19:15:07 -05:00
compat Regen 2021-12-20 02:29:11 +02:00
conf Per-thread stack canary on arm64 2021-12-20 11:09:27 +00:00
contrib ipfilter: Fix struct ifnet pointer type 2021-12-21 15:34:41 -08:00
crypto aesni: Fix an out-of-bounds read in AES_GCM_decrypt() 2021-12-27 10:45:36 -05:00
ddb ddb: reliably fail with ambiguous commands 2021-07-02 14:13:24 -07:00
dev amdsbwd: always enable watchdog register decoding 2021-12-27 13:37:29 +02:00
dts add rk3328 overlay for enabling analog sound 2021-11-21 12:04:42 +02:00
fs nfscl: add a filesize limit check to nfs_allocate() 2021-12-26 16:55:09 -08:00
gdb gdb: report specific stop reason for watchpoints 2021-04-21 10:20:33 -03:00
geom GEOM: Switch g_io_deliver() locking from cp to pp. 2021-12-07 23:06:25 -05:00
gnu Remove the old dts imported tree. 2021-01-15 20:09:55 +01:00
i386 x86: Deduplicate clock.h 2021-12-27 10:48:00 -05:00
isa Remove more remnants of sio(4) 2021-04-14 09:19:49 -04:00
kern Regen 2021-12-20 02:29:11 +02:00
kgssapi State kgssapi dependency on xdr. 2020-09-17 22:29:38 +00:00
libkern Switch to an ifunc in the kernel for crc32c 2021-08-30 12:22:21 +01:00
mips Clean up a couple of MD warts in vm_fault_populate(): 2021-12-27 19:35:55 -05:00
modules zfs: merge openzfs/zfs@af88d47f1 (zfs-2.1-release) into stable/13 2021-12-19 16:25:26 +01:00
net if_pflog: fix packet length 2021-12-11 10:38:50 +01:00
net80211 net80211(4): Fix a typo in a sysctl description 2021-12-07 19:53:33 +01:00
netgraph ng_l2tp: improve seq structure locking. 2021-12-20 01:21:38 +07:00
netinet kernel: partially revert e9efb1125a15, default inet mask 2021-12-10 10:28:06 -06:00
netinet6 netinet6: Fix a typo in a sysctl description 2021-12-03 16:53:41 +01:00
netipsec ipsec: fix a logic error in key_do_getnewspi 2021-12-19 14:44:52 +00:00
netpfil pfsync: fix incorrect enabling of defer mode 2021-12-13 14:49:27 +01:00
netsmb netsmb: Avoid a read-after-free in smb_t2_request_int() 2021-06-02 09:34:47 -04:00
nfs kernel: partially revert e9efb1125a15, default inet mask 2021-12-10 10:28:06 -06:00
nfsclient nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nfsserver nfs: Mark unused statistics variable as reserved 2020-11-18 04:35:49 +00:00
nlm nlm: clean up empty lines in .c and .h files 2020-09-01 22:14:52 +00:00
ofed socket: Rename sb(un)lock() and interlock with listen(2) 2021-10-07 09:56:47 -04:00
opencrypto ktls: Split encrypt vs decrypt OCF counters. 2021-11-23 15:11:54 -08:00
powerpc Clean up a couple of MD warts in vm_fault_populate(): 2021-12-27 19:35:55 -05:00
riscv busdma: Remove outdated comments about Giant. 2021-12-23 20:05:17 -05:00
rpc mbuf: Only allow extpg mbufs if the system has a direct map 2021-11-29 20:34:54 -05:00
security Thread creation privilege for realtime group 2021-12-19 04:42:52 +02:00
sys hwpmc: Add IDs for Intel Comet/Ice/Tiger/Rocketlake CPUs. 2021-12-25 19:47:16 -05:00
teken loader: implement framebuffer console 2021-01-02 21:41:36 +02:00
tests routing: add IPv6 fib validation procedure. 2021-09-07 21:02:58 +00:00
tools makesyscalls.lua: add a CAPENABLED flag 2021-10-20 00:19:56 +01:00
ufs ffs_softdep: Fix a typo in a source code comment 2021-11-28 12:43:32 +01:00
vm vm_fault: Fix vm_fault_populate()'s handling of VM_FAULT_WIRE 2021-12-27 19:36:07 -05:00
x86 x86: Deduplicate clock.h 2021-12-27 10:48:00 -05:00
xdr xdr: clean up empty lines in .c and .h files 2020-09-01 22:13:28 +00:00
xen xen: remove .swp file from public headers 2021-01-11 18:14:11 +01:00
Makefile