OpenCloudOS-Kernel/drivers/xen
Juergen Gross 8881bf067a xen/gnttab: fix gnttab_end_foreign_access() without page specified
Commit 42baefac63 upstream.

gnttab_end_foreign_access() is used to free a grant reference and
optionally to free the associated page. In case the grant is still in
use by the other side processing is being deferred. This leads to a
problem in case no page to be freed is specified by the caller: the
caller doesn't know that the page is still mapped by the other side
and thus should not be used for other purposes.

The correct way to handle this situation is to take an additional
reference to the granted page in case handling is being deferred and
to drop that reference when the grant reference could be freed
finally.

This requires that there are no users of gnttab_end_foreign_access()
left directly repurposing the granted page after the call, as this
might result in clobbered data or information leaks via the not yet
freed grant reference.

This is part of CVE-2022-23041 / XSA-396.

Reported-by: Simon Gaiser <simon@invisiblethingslab.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: samuelliao <samuelliao@tencent.com>
2024-06-11 20:41:39 +08:00
..
events ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
xen-pciback ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
xenbus xen/xenbus: don't let xenbus_grant_ring() remove grants in error case 2024-06-11 20:41:34 +08:00
xenfs Merge branch 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-07-19 10:42:02 -07:00
Kconfig tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
Makefile xen: remove tmem driver 2019-07-17 08:09:58 +02:00
acpi.c xen: rename dom0_op to platform_op 2015-12-21 14:40:55 +00:00
arm-device.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
balloon.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
biomerge.c block: pass page to xen_biovec_phys_mergeable 2019-04-01 12:11:13 -06:00
cpu_hotplug.c xen, cpu_hotplug: Prevent an out of bounds access 2019-03-08 17:58:14 +01:00
dbgp.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
efi.c xen/efi: have a common runtime setup function 2019-10-02 10:31:07 -04:00
evtchn.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
features.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
gntalloc.c xen/gntalloc: don't use gnttab_query_foreign_access() 2024-06-11 20:41:33 +08:00
gntdev-common.h xen/gntdev: Add initial support for dma-buf UAPI 2018-07-26 23:05:14 -04:00
gntdev-dmabuf.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
gntdev-dmabuf.h xen/gntdev: Do not destroy context while dma-bufs are in use 2019-02-18 06:50:03 +01:00
gntdev.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
grant-table.c xen/gnttab: fix gnttab_end_foreign_access() without page specified 2024-06-11 20:41:39 +08:00
manage.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
mcelog.c xen/mcelog: eliminate redundant setting of interface version 2018-08-20 14:46:18 -04:00
mem-reservation.c xen/balloon: add runtime control for scrubbing ballooned out pages 2018-09-14 08:51:10 -04:00
pci.c xen/pci: reserve MCFG areas earlier 2019-09-12 15:02:55 -04:00
pcpu.c xen: rename dom0_op to platform_op 2015-12-21 14:40:55 +00:00
platform-pci.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
preempt.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
privcmd-buf.c xen/privcmd-buf.c: convert to use vm_map_pages_zero() 2019-05-14 09:47:50 -07:00
privcmd.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
privcmd.h xen: add new hypercall buffer mapping device 2018-06-22 08:26:42 +02:00
pvcalls-back.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
pvcalls-front.c xen/pvcalls: use alloc/free_pages_exact() 2024-06-11 20:41:39 +08:00
pvcalls-front.h xen: fix poll misannotation 2018-02-01 10:07:32 -05:00
swiotlb-xen.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
sys-hypervisor.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
time.c x86/paravirt: Use a single ops structure 2018-09-03 16:50:35 +02:00
xen-acpi-cpuhotplug.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 12 2019-05-21 11:28:45 +02:00
xen-acpi-memhotplug.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 12 2019-05-21 11:28:45 +02:00
xen-acpi-pad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
xen-acpi-processor.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
xen-balloon.c tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
xen-front-pgdir-shbuf.c xen: Introduce shared buffer helpers for page directory... 2018-12-18 12:15:55 -05:00
xen-scsiback.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
xen-stub.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 12 2019-05-21 11:28:45 +02:00
xlate_mmu.c xen: avoid link error on ARM 2019-07-31 08:14:12 +02:00