Commit d085eb8c authored by Michael S. Tsirkin's avatar Michael S. Tsirkin

vhost: disable for OABI

vhost is currently broken on the some ARM configs.

The reason is that the ring element addresses are passed between
components with different alignments assumptions. Thus, if
guest selects a pointer and host then gets and dereferences
it, then alignment assumed by the host's compiler might be
greater than the actual alignment of the pointer.
compiler on the host from assuming pointer is aligned.

This actually triggers on ARM with -mabi=apcs-gnu - which is a
deprecated configuration. With this OABI, compiler assumes that
all structures are 4 byte aligned - which is stronger than
virtio guarantees for available and used rings, which are
merely 2 bytes. Thus a guest without -mabi=apcs-gnu running
on top of host with -mabi=apcs-gnu will be broken.

The correct fix is to force alignment of structures - however
that is an intrusive fix that's best deferred until the next release.

We didn't previously support such ancient systems at all - this surfaced
after vdpa support prompted removing dependency of vhost on
VIRTULIZATION. So for now, let's just add something along the lines of

	depends on !ARM || AEABI

to the virtio Kconfig declaration, and add a comment that it has to do
with struct member alignment.

Note: we can't make VHOST and VHOST_RING themselves have
a dependency since these are selected. Add a new symbol for that.

We should be able to drop this dependency down the road.

Fixes: 20c384f1 ("vhost: refine vhost and vringh kconfig")
Suggested-by: default avatarArd Biesheuvel <ardb@kernel.org>
Suggested-by: default avatarRichard Earnshaw <Richard.Earnshaw@arm.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 15064e70
...@@ -116,7 +116,7 @@ config MIC_COSM ...@@ -116,7 +116,7 @@ config MIC_COSM
config VOP config VOP
tristate "VOP Driver" tristate "VOP Driver"
depends on VOP_BUS depends on VOP_BUS && VHOST_DPN
select VHOST_RING select VHOST_RING
select VIRTIO select VIRTIO
help help
......
...@@ -50,7 +50,7 @@ config CAIF_HSI ...@@ -50,7 +50,7 @@ config CAIF_HSI
config CAIF_VIRTIO config CAIF_VIRTIO
tristate "CAIF virtio transport driver" tristate "CAIF virtio transport driver"
depends on CAIF && HAS_DMA depends on CAIF && HAS_DMA && VHOST_DPN
select VHOST_RING select VHOST_RING
select VIRTIO select VIRTIO
select GENERIC_ALLOCATOR select GENERIC_ALLOCATOR
......
...@@ -10,7 +10,7 @@ if VDPA ...@@ -10,7 +10,7 @@ if VDPA
config VDPA_SIM config VDPA_SIM
tristate "vDPA device simulator" tristate "vDPA device simulator"
depends on RUNTIME_TESTING_MENU && HAS_DMA depends on RUNTIME_TESTING_MENU && HAS_DMA && VHOST_DPN
select VHOST_RING select VHOST_RING
default n default n
help help
......
...@@ -13,6 +13,15 @@ config VHOST_RING ...@@ -13,6 +13,15 @@ config VHOST_RING
This option is selected by any driver which needs to access This option is selected by any driver which needs to access
the host side of a virtio ring. the host side of a virtio ring.
config VHOST_DPN
bool
depends on !ARM || AEABI
default y
help
Anything selecting VHOST or VHOST_RING must depend on VHOST_DPN.
This excludes the deprecated ARM ABI since that forces a 4 byte
alignment on all structs - incompatible with virtio spec requirements.
config VHOST config VHOST
tristate tristate
select VHOST_IOTLB select VHOST_IOTLB
...@@ -28,7 +37,7 @@ if VHOST_MENU ...@@ -28,7 +37,7 @@ if VHOST_MENU
config VHOST_NET config VHOST_NET
tristate "Host kernel accelerator for virtio net" tristate "Host kernel accelerator for virtio net"
depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP) depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP) && VHOST_DPN
select VHOST select VHOST
---help--- ---help---
This kernel module can be loaded in host kernel to accelerate This kernel module can be loaded in host kernel to accelerate
...@@ -40,7 +49,7 @@ config VHOST_NET ...@@ -40,7 +49,7 @@ config VHOST_NET
config VHOST_SCSI config VHOST_SCSI
tristate "VHOST_SCSI TCM fabric driver" tristate "VHOST_SCSI TCM fabric driver"
depends on TARGET_CORE && EVENTFD depends on TARGET_CORE && EVENTFD && VHOST_DPN
select VHOST select VHOST
default n default n
---help--- ---help---
...@@ -49,7 +58,7 @@ config VHOST_SCSI ...@@ -49,7 +58,7 @@ config VHOST_SCSI
config VHOST_VSOCK config VHOST_VSOCK
tristate "vhost virtio-vsock driver" tristate "vhost virtio-vsock driver"
depends on VSOCKETS && EVENTFD depends on VSOCKETS && EVENTFD && VHOST_DPN
select VHOST select VHOST
select VIRTIO_VSOCKETS_COMMON select VIRTIO_VSOCKETS_COMMON
default n default n
...@@ -63,7 +72,7 @@ config VHOST_VSOCK ...@@ -63,7 +72,7 @@ config VHOST_VSOCK
config VHOST_VDPA config VHOST_VDPA
tristate "Vhost driver for vDPA-based backend" tristate "Vhost driver for vDPA-based backend"
depends on EVENTFD depends on EVENTFD && VHOST_DPN
select VHOST select VHOST
depends on VDPA depends on VDPA
help help
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment