linux/drivers/xen
Juergen Gross 24daca4fc0 xen/privcmd: fix double free via VMA splitting
privcmd_vm_ops defines .close (privcmd_close), but neither .may_split
nor .open. When userspace does a partial munmap() on a privcmd mapping,
the kernel splits the VMA via __split_vma(). Since may_split is NULL,
the split is allowed. vm_area_dup() copies vm_private_data (a pages
array allocated in alloc_empty_pages()) into the new VMA without any
fixup, because there is no .open callback.

Both VMAs now point to the same pages array. When the unmapped portion
is closed, privcmd_close() calls:
    - xen_unmap_domain_gfn_range()
    - xen_free_unpopulated_pages()
    - kvfree(pages)

The surviving VMA still holds the dangling pointer. When it is later
destroyed, the same sequence runs again, which leads to a double free.

Fix this issue by adding a .may_split callback denying the VMA split.

This is XSA-487 / CVE-2026-31787

Fixes: d71f513985 ("xen: privcmd: support autotranslated physmap guests.")
Reported-by: Atharva Vartak <atharva.a.vartak@gmail.com>
Suggested-by: Atharva Vartak <atharva.a.vartak@gmail.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2026-04-23 15:32:59 +02:00
..
events Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
xen-pciback PCI: use generic driver_override infrastructure 2026-04-04 00:44:30 +02:00
xenbus xen: branch for v7.0-rc3 2026-03-07 07:44:32 -08:00
xenfs convert xenfs 2025-11-16 01:35:02 -05:00
acpi.c ACPI: PCI: IRQ: Fix INTx GSIs signedness 2026-01-05 19:06:40 +01:00
arm-device.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
balloon.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
biomerge.c
cpu_hotplug.c
dbgp.c
efi.c
evtchn.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
features.c
gntalloc.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
gntdev-common.h xen/gntdev: remove struct gntdev_copy_batch from stack 2025-07-14 17:10:09 +02:00
gntdev-dmabuf.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
gntdev-dmabuf.h drivers/xen/gntdev: use xen_pv_domain() instead of cached value 2025-09-08 17:01:36 +02:00
gntdev.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
grant-dma-iommu.c
grant-dma-ops.c xen/virtio: Don't use grant-dma-ops when running as Dom0 2026-01-12 13:05:51 +01:00
grant-table.c xen/grant-table: guard gnttab_suspend/resume with CONFIG_HIBERNATE_CALLBACKS 2026-04-10 11:07:21 +02:00
Kconfig mm: rename vm_ops->find_special_page() to vm_ops->find_normal_page() 2025-09-13 16:54:53 -07:00
Makefile
manage.c xen/manage: unwind partial shutdown watcher setup on error 2026-04-10 11:04:02 +02:00
mcelog.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mem-reservation.c
pci.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pcpu.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
platform-pci.c
privcmd-buf.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
privcmd.c xen/privcmd: fix double free via VMA splitting 2026-04-23 15:32:59 +02:00
privcmd.h
pvcalls-back.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pvcalls-front.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pvcalls-front.h
swiotlb-xen.c dma-mapping updates for Linux 7.0: 2026-04-17 11:12:42 -07:00
sys-hypervisor.c Buffer overflow in drivers/xen/sys-hypervisor.c 2026-04-23 15:32:51 +02:00
time.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
unpopulated-alloc.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xen-acpi-pad.c ACPI: PAD: xen: Convert to a platform driver 2026-04-07 21:06:59 +02:00
xen-acpi-processor.c xen: branch for v7.0-rc3 2026-03-07 07:44:32 -08:00
xen-balloon.c
xen-front-pgdir-shbuf.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
xen-scsiback.c scsi: target: Use driver completion preference by default 2026-02-28 21:04:02 -05:00
xlate_mmu.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00