All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Iván Ezequiel Rodriguez" <ivanrwcm25@gmail.com>
To: pbonzini@redhat.com, seanjc@google.com
Cc: kvm@vger.kernel.org, linux-kselftest@lists.kernel.org,
	"Iván Ezequiel Rodriguez" <ivanrwcm25@gmail.com>
Subject: [PATCH 0/1] kvm: reject unknown flags in device and dirty-log ioctls
Date: Wed,  1 Jul 2026 16:49:45 -0300	[thread overview]
Message-ID: <20260701194946.768731-1-ivanrwcm25@gmail.com> (raw)

Three generic KVM paths silently ignored flag bits that uapi or
Documentation/virt/kvm/api.rst treat as reserved or zero-only:

- KVM_CREATE_DEVICE (only KVM_CREATE_DEVICE_TEST is defined)
- KVM_{SET,GET,HAS}_DEVICE_ATTR (kvm_device_attr.flags)
- KVM_ENABLE_CAP for KVM_CAP_DIRTY_LOG_RING{,_ACQ_REL} (cap->flags)

Reject with -EINVAL, matching dma-heap and other strict KVM ioctls.
Adds ioctl_flag_validation_test to tools/testing/selftests/kvm.

Tested: ioctl_flag_validation_test fails on the host kernel without
this patch (KVM_CREATE_DEVICE accepts flags=0x2); requires reloading
the patched kvm module to pass.

Iván Ezequiel Rodriguez (1):
  kvm: reject unknown flags in device and dirty-log ioctls

 tools/testing/selftests/kvm/Makefile.kvm           |   1 +
 .../selftests/kvm/ioctl_flag_validation_test.c     | 104 +++++++++++++++++++++
 virt/kvm/kvm_main.c                                |   9 ++
 3 files changed, 114 insertions(+)

-- 
2.43.0

             reply	other threads:[~2026-07-01 19:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 19:49 Iván Ezequiel Rodriguez [this message]
2026-07-01 19:49 ` [PATCH 1/1] kvm: reject unknown flags in device and dirty-log ioctls Iván Ezequiel Rodriguez
2026-07-01 20:09   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260701194946.768731-1-ivanrwcm25@gmail.com \
    --to=ivanrwcm25@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kselftest@lists.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.