mshv: Allow mappings that overlap in uaddr
authorMagnus Kulke <magnuskulke@linux.microsoft.com>
Thu, 6 Nov 2025 22:13:31 +0000 (14:13 -0800)
committerWei Liu <wei.liu@kernel.org>
Sat, 15 Nov 2025 06:18:17 +0000 (06:18 +0000)
commitf91bc8f61abf0e1d23108ae9871c60d7612a09b2
tree95df4fda5dad7c4c66bc8d37f5a6d12f781800a6
parentba9eb9b86d232854e983203dc2fb1ba18e316681
mshv: Allow mappings that overlap in uaddr

Currently the MSHV driver rejects mappings that would overlap in
userspace.

Some VMMs require the same memory to be mapped to different parts of
the guest's address space, and so working around this restriction is
difficult.

The hypervisor itself doesn't prohibit mappings that overlap in uaddr,
(really in SPA; system physical addresses), so supporting this in the
driver doesn't require any extra work: only the checks need to be
removed.

Since no userspace code until now has been able to overlap regions in
userspace, relaxing this constraint can't break any existing code.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/mshv_root_main.c
include/uapi/linux/mshv.h