Vitaly Kuznetsov 1b122192e0 xen/privcmd: fix double free via VMA splitting
JIRA: https://redhat.atlassian.net/browse/RHEL-172489
CVE: CVE-2026-31787

commit 24daca4fc07f3ff8cd0e3f629cd982187f48436a
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Apr 10 09:20:04 2026 +0200

    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>

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
2026-08-26 15:32:37 +02:00
2026-08-20 12:21:17 +00:00
2026-08-21 17:23:26 +00:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.
S
Description
No description provided
Readme
2.8 GiB
Languages
C 97.6%
Assembly 1%
Shell 0.5%
Python 0.3%
Makefile 0.3%
Other 0.1%