Linux kernel source tree
Go to file
Sean Christopherson fe2bf6234e KVM: guest_memfd: Add INIT_SHARED flag, reject user page faults if not set
Add a guest_memfd flag to allow userspace to state that the underlying
memory should be configured to be initialized as shared, and reject user
page faults if the guest_memfd instance's memory isn't shared.  Because
KVM doesn't yet support in-place private<=>shared conversions, all
guest_memfd memory effectively follows the initial state.

Alternatively, KVM could deduce the initial state based on MMAP, which for
all intents and purposes is what KVM currently does.  However, implicitly
deriving the default state based on MMAP will result in a messy ABI when
support for in-place conversions is added.

For x86 CoCo VMs, which don't yet support MMAP, memory is currently private
by default (otherwise the memory would be unusable).  If MMAP implies
memory is shared by default, then the default state for CoCo VMs will vary
based on MMAP, and from userspace's perspective, will change when in-place
conversion support is added.  I.e. to maintain guest<=>host ABI, userspace
would need to immediately convert all memory from shared=>private, which
is both ugly and inefficient.  The inefficiency could be avoided by adding
a flag to state that memory is _private_ by default, irrespective of MMAP,
but that would lead to an equally messy and hard to document ABI.

Bite the bullet and immediately add a flag to control the default state so
that the effective behavior is explicit and straightforward.

Fixes: 3d3a04fad2 ("KVM: Allow and advertise support for host mmap() on guest_memfd files")
Cc: David Hildenbrand <david@redhat.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com>
Reviewed-by: Ackerley Tng <ackerleytng@google.com>
Tested-by: Ackerley Tng <ackerleytng@google.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20251003232606.4070510-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
2025-10-10 14:25:23 -07:00
Documentation KVM: guest_memfd: Add INIT_SHARED flag, reject user page faults if not set 2025-10-10 14:25:23 -07:00
LICENSES LICENSES: Replace the obsolete address of the FSF in the GFDL-1.2 2025-07-24 11:15:39 +02:00
arch KVM: x86/pmu: Don't try to get perf capabilities for hybrid CPUs 2025-10-10 14:25:12 -07:00
block vfs-6.17-rc6.fixes 2025-09-08 07:53:01 -07:00
certs sign-file,extract-cert: use pkcs11 provider for OPENSSL MAJOR >= 3 2024-09-20 19:52:48 +03:00
crypto This push fixes a NULL pointer dereference in ccp and a couple of 2025-09-19 09:58:21 -07:00
drivers KVM: s390/vfio-ap: Use kvm_is_gpa_in_memslot() instead of open coded equivalent 2025-09-30 13:38:06 -04:00
fs for-6.17-rc6-tag 2025-09-20 21:41:26 -07:00
include KVM: guest_memfd: Add INIT_SHARED flag, reject user page faults if not set 2025-10-10 14:25:23 -07:00
init 20 hotfixes. 15 are cc:stable and the remainder address post-6.16 issues 2025-09-10 21:19:34 -07:00
io_uring io_uring-6.17-20250919 2025-09-19 12:10:49 -07:00
ipc vfs-6.17-rc1.mmap_prepare 2025-07-28 13:43:25 -07:00
kernel Runtime Verifier fixes for v6.17 2025-09-18 15:22:00 -07:00
lib hardening fixes for v6.17-rc4 2025-08-31 08:56:45 -07:00
mm 15 hotfixes. 11 are cc:stable and the remainder address post-6.16 issues 2025-09-17 21:34:26 -07:00
net Including fixes from wireless. No known regressions at this point. 2025-09-18 10:22:02 -07:00
rust Driver core fixes for 6.17-rc6 2025-09-13 10:36:06 -07:00
samples 15 hotfixes. 11 are cc:stable and the remainder address post-6.16 issues 2025-09-17 21:34:26 -07:00
scripts Rust fixes for v6.17 (2nd) 2025-09-06 12:33:09 -07:00
security + Features 2025-08-04 08:17:28 -07:00
sound ALSA: hda/realtek: Fix mute led for HP Laptop 15-dw4xx 2025-09-18 21:10:05 +02:00
tools KVM: guest_memfd: Add INIT_SHARED flag, reject user page faults if not set 2025-10-10 14:25:23 -07:00
usr usr/include: openrisc: don't HDRTEST bpf_perf_event.h 2025-05-12 15:03:17 +09:00
virt KVM: guest_memfd: Add INIT_SHARED flag, reject user page faults if not set 2025-10-10 14:25:23 -07:00
.clang-format Linux 6.15-rc5 2025-05-06 16:39:25 +10:00
.clippy.toml rust: clean Rust 1.88.0's warning about `clippy::disallowed_macros` configuration 2025-05-07 00:11:47 +02:00
.cocciconfig
.editorconfig .editorconfig: remove trim_trailing_whitespace option 2024-06-13 16:47:52 +02:00
.get_maintainer.ignore MAINTAINERS: Retire Ralf Baechle 2024-11-12 15:48:59 +01:00
.gitattributes
.gitignore gitignore: allow .pylintrc to be tracked 2025-07-02 17:10:04 -06:00
.mailmap MAINTAINERS: Update Nobuhiro Iwamatsu's email address 2025-09-01 10:36:10 +02:00
.pylintrc docs: add a .pylintrc file with sys path for docs scripts 2025-04-09 12:10:33 -06:00
.rustfmt.toml
COPYING
CREDITS MAINTAINERS: retire Boris from TLS maintainers 2025-08-26 17:36:01 -07:00
Kbuild drm: ensure drm headers are self-contained and pass kernel-doc 2025-02-12 10:44:43 +02:00
Kconfig io_uring: Rename KConfig to Kconfig 2025-02-19 14:53:27 -07:00
MAINTAINERS Runtime Verifier fixes for v6.17 2025-09-18 15:22:00 -07:00
Makefile Linux 6.17-rc7 2025-09-21 15:08:52 -07:00
README

README

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 reStructuredText 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.