rust-vmm / kvm-ioctls

Apache License 2.0
270 stars 106 forks source link

move encrypt_op{_sev} into system ioctls #259

Open jakecorrenti opened 6 months ago

jakecorrenti commented 6 months ago

Summary of the PR

According to the KVM API, KVM_MEMORY_ENCRYPT_OP is labeled as a system ioctl. However, it is currently treated as a VM ioctl. There are no functional changes to the code, only the location and function signature.

Requirements

Before submitting your PR, please make sure you addressed the following requirements:

jakecorrenti commented 6 months ago

Just for reference, this is the documentation that states the KVM API now uses MEMORY_ENCRYPT_OP as a system ioctl: https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt

rbradford commented 4 months ago

Just for reference, this is the documentation that states the KVM API now uses MEMORY_ENCRYPT_OP as a system ioctl: https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt

Not sure how old that documentation is - but v6.9 - the last release version shows this is a vm type ioctl - https://elixir.bootlin.com/linux/v6.9/source/Documentation/virt/kvm/api.rst#L4732

The wrong label was fixed in https://github.com/torvalds/linux/commit/46ca9ee5b833659dd3af56b7e4253d8994a87962

rbradford commented 4 months ago

I identified the issue as a case of stale content on kernel.org when the directory was renamed by

commit 2f5947dfcaecb99f2dd559156eecbeb7b95e4c02
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Jul 24 09:24:49 2019 +0200

    Documentation: move Documentation/virtual to Documentation/virt

    Renaming docs seems to be en vogue at the moment, so fix on of the
    grossly misnamed directories.  We usually never use "virtual" as
    a shortcut for virtualization in the kernel, but always virt,
    as seen in the virt/ top-level directory.  Fix up the documentation
    to match that.

    Fixes: ed16648eb5b8 ("Move kvm, uml, and lguest subdirectories under a common "virtual" directory, I.E:")
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Compare - https://www.kernel.org/doc/Documentation/virt/kvm/api.txt (current) with https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt (stale)

I have contacted the kernel.org team to highlight the issue.

jakecorrenti commented 4 months ago

I identified the issue as a case of stale content on kernel.org when the directory was renamed by

commit 2f5947dfcaecb99f2dd559156eecbeb7b95e4c02 Author: Christoph Hellwig hch@lst.de Date: Wed Jul 24 09:24:49 2019 +0200

Documentation: move Documentation/virtual to Documentation/virt

Renaming docs seems to be en vogue at the moment, so fix on of the
grossly misnamed directories.  We usually never use "virtual" as
a shortcut for virtualization in the kernel, but always virt,
as seen in the virt/ top-level directory.  Fix up the documentation
to match that.

Fixes: ed16648eb5b8 ("Move kvm, uml, and lguest subdirectories under a common "virtual" directory, I.E:")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Compare - https://www.kernel.org/doc/Documentation/virt/kvm/api.txt (current) with https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt (stale)

I have contacted the kernel.org team to highlight the issue.

Thank you for doing that.

However, I still see this change being needed (with some adjustments). Intel TDX (and I think Arm CCA as well) is repurposing this ioctl and it is used on both Vm fd's and Vcpu fd's. Intel's documentation about it can be located here.