freebsd-dev/sys
Kyle Evans 4be0a1b587 _umtx_op: fix a compat32 bug in UMTX_OP_NWAKE_PRIVATE
Specifically, if we're waking up some value n > BATCH_SIZE, then the
copyin(9) is wrong on the second iteration due to upp being the wrong type.
upp is currently a uint32_t**, so upp + pos advances it by twice as many
elements as it should (host pointer size vs. compat32 pointer size).

Fix it by just making upp a uint32_t*; it's still technically a double
pointer, but the distinction doesn't matter all that much here since we're
just doing arithmetic on it.

Add a test case that demonstrates the problem, placed with the libthr tests
since one messing with _umtx_op should be running these tests. Running under
compat32, the new test case will hang as threads after the first 128 get
missed in the wake. it's not immediately clear how to hit it in practice,
since pthread_cond_broadcast() uses a smaller (sleepq batch?) size observed
to be around ~50 -- I did not spend much time digging into it.

The uintptr_t change makes no functional difference, but i've tossed it in
since it's more accurate (semantically).

Reported by:	Andrew Gierth (andrew_tao173.riddles.org.uk, inspection)
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27231
2020-11-17 03:34:01 +00:00
..
amd64 vmm: Make pmap_invalidate_ept() wait synchronously for guest exits 2020-11-11 15:01:17 +00:00
arm Remove the 'nap' field from ARM's 'struct syscall_args', to bring it 2020-11-05 18:10:03 +00:00
arm64 Introduce IOMMU support for arm64 platform. 2020-11-16 21:55:52 +00:00
bsm
cam Make CTL nicer to increased MAXPHYS. 2020-11-11 21:59:39 +00:00
cddl malloc: move malloc_type_internal into malloc_type 2020-11-06 21:33:59 +00:00
compat LinuxKPI: Exclude linux/acpi.h content on non-ACPI archs. 2020-11-14 10:34:18 +00:00
conf Introduce IOMMU support for arm64 platform. 2020-11-16 21:55:52 +00:00
contrib zfs: disable periodic arc updates 2020-11-14 19:23:07 +00:00
crypto Check cipher key lengths during probesession. 2020-11-05 23:31:58 +00:00
ddb db_search_symbol: prevent pollution from bogus symbols 2020-10-26 16:42:53 +00:00
dev Fix a bug in assertion: entry flags also includes IOMMU_MAP_ENTRY_UNMAPPED. 2020-11-16 15:37:09 +00:00
dts Brand our DTS with the Linux version it was imported from 2020-10-10 07:18:51 +00:00
fs Make it possible to mount a fuse filesystem, such as squashfuse, 2020-11-09 08:53:15 +00:00
gdb gdb(4): Don't escape GDB special characters at application layer 2020-09-30 14:55:54 +00:00
geom gbde: replace malloc_last_fail with a kludge 2020-11-12 20:20:57 +00:00
gnu Brand our DTS with the Linux version it was imported from 2020-10-10 07:18:51 +00:00
i386 linux(4): Deduplicate unimpl/dummy syscall handlers 2020-11-05 19:30:31 +00:00
isa
kern _umtx_op: fix a compat32 bug in UMTX_OP_NWAKE_PRIVATE 2020-11-17 03:34:01 +00:00
kgssapi
libkern arc4random(9): Integrate with RANDOM_FENESTRASX push-reseed 2020-10-10 21:48:06 +00:00
mips Remove 'struct trapframe' pointer from mips64's 'struct syscall_args'. 2020-11-06 19:19:51 +00:00
modules LinuxKPI: Implement ACPI bits required by drm-kmod in base system 2020-11-09 13:20:14 +00:00
net iflib: Free full mbuf chains when draining transmit queues 2020-11-11 18:00:06 +00:00
net80211 net80211: fix a typo 2020-11-04 12:07:33 +00:00
netgraph ng_nat: unbreak ABI 2020-11-10 02:26:44 +00:00
netinet ip_fastfwd: style(9) tidy for r367628 2020-11-13 18:25:07 +00:00
netinet6 Fix implicit automatic local port selection for IPv6 during connect calls. 2020-11-14 14:50:34 +00:00
netipsec Trigger soft lifetime expiration on sequence number 2020-10-16 11:27:01 +00:00
netpfil Add dtrace SDT probe ipfw:::rule-matched. 2020-10-21 15:01:33 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Fix for referencing file via its vnode in ibore. 2020-11-02 10:44:29 +00:00
opencrypto Use void * in place of caddr_t. 2020-11-06 18:09:52 +00:00
powerpc [PowerPC64LE] Radix MMU fixes for LE. 2020-11-13 16:56:03 +00:00
riscv riscv: set kernel_pmap hart mask more precisely 2020-11-05 00:52:52 +00:00
rpc
security
sys cpuset: reorder so that cs_mask does not share cacheline with cs_ref 2020-11-17 00:04:30 +00:00
teken Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
tests
tools Brand our DTS with the Linux version it was imported from 2020-10-10 07:18:51 +00:00
ufs Handle LoR in flush_pagedep_deps(). 2020-11-14 05:30:10 +00:00
vm vm_map: Handle kernel map entry allocator recursion 2020-11-11 17:16:39 +00:00
x86 Add device_t member to struct iommu. 2020-11-16 15:29:52 +00:00
xdr
xen
Makefile