opnsense-src/sys
Mark Johnston 302c426103 riscv: Fix another race in pmap_pinit()
Commit c862d5f2a7 ("riscv: Fix a race in pmap_pinit()") did not really
fix the race.  Alan writes,

 Suppose that N entries in the L1 tables are in use, and we are in the
 middle of the memcpy().  Specifically, we have read the zero-filled
 (N+1)st entry from the kernel L1 table.  Then, we are preempted.  Now,
 another core/thread does pmap_growkernel(), which fills the (N+1)st
 entry.  Finally, we return to the original core/thread, and overwrite
 the valid entry with the zero that we earlier read.

Try to fix the race properly, by copying kernel L1 entries while holding
the allpmaps lock.  To avoid doing unnecessary work while holding this
global lock, copy only the entries that we expect to be valid.

Fixes:		c862d5f2a7 ("riscv: Fix a race in pmap_pinit()")
Reported by:	alc, jrtc27
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d5c0a7b6d3)
2022-03-01 10:17:40 -05:00
..
amd64 ed: Remove options 2022-02-22 11:44:56 -07:00
arm sched: separate out schedinit_ap() 2022-02-10 14:55:29 -06:00
arm64 Stop single stepping in signal handers on arm64 2022-02-22 16:23:07 +00:00
bsm Add aio_writev and aio_readv 2021-01-02 19:57:58 -07:00
cam Fix non-printable characters in NVMe model and serial numbers. 2022-02-18 16:28:32 -05:00
cddl Teach DTrace about BTI on arm64 2022-02-22 16:23:07 +00:00
compat LinuxKPI: update 802.11 headers 2022-02-27 23:41:54 +00:00
conf cxgbe(4): Update firmwares to 1.26.6.0. 2022-02-27 22:48:07 -08:00
contrib iwlwifi: update firmware 2022-02-27 23:41:55 +00:00
crypto Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2022-02-08 15:00:55 -05:00
ddb ddb: reliably fail with ambiguous commands 2021-07-02 14:13:24 -07:00
dev cxgbe(4): Fix illegal hardware access in cxgbe_refresh_stats. 2022-02-27 22:51:51 -08:00
dts add overlay for enabling i2c1 on allwinner h3 2022-02-09 11:35:59 +02:00
fs msdosfs: Fix mounting when the device sector size is >512B 2022-02-21 09:57:54 -05:00
gdb gdb(4): Do not use run length encoding for 3-symbol repetitions 2022-02-04 20:58:34 -05:00
geom geom: add kqfilter support for geom dev 2022-02-23 08:26:49 -09:00
gnu Remove the old dts imported tree. 2021-01-15 20:09:55 +01:00
i386 ed: Remove options 2022-02-22 11:44:56 -07:00
isa Remove more remnants of sio(4) 2021-04-14 09:19:49 -04:00
kern sleepqueue: Annotate sleepq_max_depth as static 2022-02-21 09:57:46 -05:00
kgssapi State kgssapi dependency on xdr. 2020-09-17 22:29:38 +00:00
libkern Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2022-02-08 15:00:55 -05:00
mips sched: separate out schedinit_ap() 2022-02-10 14:55:29 -06:00
modules cxgbe(4): Update firmwares to 1.26.6.0. 2022-02-27 22:48:07 -08:00
net bridge: Don't share broadcast packets 2022-02-28 16:38:05 +01:00
net80211 net80211: enhance (disabled) debugging 2022-02-20 16:24:57 +00:00
netgraph ng pppoe(4): Add the required NET_EPOCH section to the hook 2022-02-13 15:05:45 +03:00
netinet netinet: allow UDP tunnels to be removed 2022-02-28 16:38:05 +01:00
netinet6 MFC 2290dfb40f: 2022-02-25 14:49:33 -05:00
netipsec syncache: accept packet with no SA when TCP_MD5SIG is set 2022-02-10 10:31:33 -09:00
netpfil pf: fix set_prio after nv conversion 2022-02-21 10:18:24 +01:00
netsmb netsmb: Avoid a read-after-free in smb_t2_request_int() 2021-06-02 09:34:47 -04:00
nfs nfs: don't truncate directory cookies to 32-bits in the NFS server 2022-01-02 20:09:15 -07: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 Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2022-02-08 15:00:55 -05:00
powerpc sched: separate out schedinit_ap() 2022-02-10 14:55:29 -06:00
riscv riscv: Fix another race in pmap_pinit() 2022-03-01 10:17:40 -05:00
rpc rpc: Delete AUTH_NEEDS_TLS(_MUTUAL_HOST) auth_stat values 2021-12-29 17:23:30 -08:00
security Thread creation privilege for realtime group 2021-12-19 04:42:52 +02:00
sys mbuf: make M_ASSERT_NO_SND_TAG() as strict as other similar asserts 2022-02-25 10:57:10 +01: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 Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2022-02-08 15:00:55 -05:00
ufs ufs: handle LoR between snap lock and vnode lock 2022-02-15 16:01:23 -08:00
vm vm_pageout: Print a more accurate message to the console before an OOM kill 2022-02-28 09:06:58 -05:00
x86 linux: deduplicate DUMMY() entries 2022-02-13 22:22:11 +00:00
xdr xdr: clean up empty lines in .c and .h files 2020-09-01 22:13:28 +00:00
xen xen(4): Fix a common typo in a source code comments 2022-02-09 07:20:31 +01:00
Makefile