linux-uconsole/drivers/hv
Michael Kelley 4366679805 Drivers: hv: vmbus: Prevent load re-ordering when reading ring buffer
[ Upstream commit b6cae15b57 ]

When reading a packet from a host-to-guest ring buffer, there is no
memory barrier between reading the write index (to see if there is
a packet to read) and reading the contents of the packet. The Hyper-V
host uses store-release when updating the write index to ensure that
writes of the packet data are completed first. On the guest side,
the processor can reorder and read the packet data before the write
index, and sometimes get stale packet data. Getting such stale packet
data has been observed in a reproducible case in a VM on ARM64.

Fix this by using virt_load_acquire() to read the write index,
ensuring that reads of the packet data cannot be reordered
before it. Preventing such reordering is logically correct, and
with this change, getting stale data can no longer be reproduced.

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Reviewed-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Link: https://lore.kernel.org/r/1648394710-33480-1-git-send-email-mikelley@microsoft.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:23:20 +02:00
..
channel.c Drivers: hv: vmbus: Use after free in __vmbus_open() 2021-05-14 09:50:20 +02:00
channel_mgmt.c Drivers: hv: vmbus: Replace smp_store_mb() with virt_store_mb() 2022-04-13 21:01:11 +02:00
connection.c drivers: hv: Fix missing error code in vmbus_connect() 2021-07-14 16:55:59 +02:00
hv.c hyperv-fixes for 5.10-rc5 2020-11-16 15:02:33 -08:00
hv_balloon.c hv_balloon: rate-limit "Unhandled message" warning 2022-04-08 14:40:19 +02:00
hv_debugfs.c hv_debugfs: Make hv_debug_root static 2020-04-04 17:47:43 +01:00
hv_fcopy.c hv_utils: Always execute the fcopy and vss callbacks in a tasklet 2020-04-23 13:17:11 +00:00
hv_kvp.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
hv_snapshot.c hv_utils: Always execute the fcopy and vss callbacks in a tasklet 2020-04-23 13:17:11 +00:00
hv_trace.c
hv_trace.h hyperv-next for 5.8 2020-06-03 15:00:05 -07:00
hv_trace_balloon.h
hv_util.c hv_utils: Fix passing zero to 'PTR_ERR' warning 2021-07-14 16:55:57 +02:00
hv_utils_transport.c
hv_utils_transport.h
hyperv_vmbus.h hyperv/vmbus: include linux/bitops.h 2021-11-18 14:03:42 +01:00
Kconfig Revert "hv: utils: add PTP_1588_CLOCK to Kconfig to fix build" 2022-04-13 21:01:03 +02:00
Makefile
ring_buffer.c Drivers: hv: vmbus: Prevent load re-ordering when reading ring buffer 2022-04-20 09:23:20 +02:00
vmbus_drv.c Drivers: hv: vmbus: Fix potential crash on module unload 2022-04-13 21:01:04 +02:00