From: sashiko-bot@kernel.org
To: "Peter Fang" <peter.fang@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 6/8] KVM: TDX: Document KVM_TDX_GET_QUOTE
Date: Fri, 04 Dec 2026 18:36:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-250434@kernel.org> (raw)
In-Reply-To: <20261204182022.324230-7-peter.fang@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] KVM: TDX: KVM_TDX_GET_QUOTE misdocuments hw_error as must be 0
(out)
- [Low] KVM: TDX: KVM_TDX_GET_QUOTE quote_buf_size minimum not enforced
in code
--
commit 42ca18a6ac06953778ef9347240a920d55d409db
Author: Peter Fang <peter.fang@intel.com>
KVM: TDX: Document KVM_TDX_GET_QUOTE
This commit documents the KVM_TDX_GET_QUOTE VM ioctl and its
quote_max_size capability field in
Documentation/virt/kvm/x86/intel-tdx.rst, and updates the
TDVMCALL_GET_QUOTE description in Documentation/virt/kvm/api.rst.
> diff --git a/Documentation/virt/kvm/x86/intel-tdx.rst b/Documentation/virt/kvm/x86/intel-tdx.rst
> index d8d9409120e61..1bd95f6df49d6 100644
> --- a/Documentation/virt/kvm/x86/intel-tdx.rst
> +++ b/Documentation/virt/kvm/x86/intel-tdx.rst
[ ... ]
> @@ -197,6 +203,45 @@ Complete measurement of the initial TD contents and mark it ready to run.
> - hw_error: must be 0
>
>
> +KVM_TDX_GET_QUOTE
> +-----------------
> +:Type: vm ioctl
> +:Returns: 0 on success, <0 on error
> +
> +Generate a DICE-based Quote from a TD Report. @report_uaddr points to the
> +TD Report, and @report_size is its size. @quote_buf_uaddr points to the
> +buffer for the Quote, and @quote_buf_size is its size. On success, KVM
> +writes the Quote to the buffer, and the size of the Quote to @quote_size.
> +This needs to be called after KVM_TDX_FINALIZE_VM succeeds.
> +
> +@report_uaddr and @quote_buf_uaddr must be page-aligned, and @report_size
> +must not exceed the size of a page. @quote_buf_size must be at least the
> +quote_max_size reported by KVM_TDX_CAPABILITIES.
[Severity: Low]
Does tdx_td_get_quote() actually enforce that quote_buf_size is at least
quote_max_size?
tdx_td_get_quote() clamps quote_buf_size to max_quote_size with umin()
and only returns -EINVAL when it is zero. A smaller non-zero buffer is
passed to tdx_quote_generate() and may succeed or fail with -EIO, while
larger values are silently capped.
Either tdx_td_get_quote() should reject quote_buf_size < max_quote_size,
or the documentation should state that quote_buf_size must be non-zero,
should be at least quote_max_size to guarantee the Quote fits, and is
capped at quote_max_size.
Also, tdx_td_get_quote() rejects non-zero reserved[27] in struct
kvm_tdx_get_quote with -EINVAL, which is not mentioned here.
[ ... ]
> +- id: KVM_TDX_GET_QUOTE
> +- flags: must be 0
> +- data: pointer to struct kvm_tdx_get_quote (in/out)
> +- hw_error: must be 0 (out)
[Severity: Low]
Should hw_error be documented as an in/out field that must be 0 on input
and returns the TDX SEAMCALL status code on output?
tdx_get_cmd() returns -EINVAL if cmd->hw_error is non-zero on input.
tdx_td_get_quote() -> tdx_quote_generate() then writes the TDH.QUOTE.GET
SEAMCALL status code to cmd->hw_error (returning -EIO on failure), and
tdx_vm_ioctl() copies it back to userspace.
Documenting it as "must be 0 (out)" could mislead userspace into not
zeroing hw_error on input or ignoring the returned SEAMCALL status on
-EIO.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204182022.324230-1-peter.fang@intel.com?part=6
next prev parent reply other threads:[~2026-12-04 18:36 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:18 [PATCH v3 0/8] Enable DICE-based TDX quoting Peter Fang
2026-12-04 18:18 ` [PATCH v3 1/8] x86/virt/tdx: Add interface to generate a Quote Peter Fang
2026-12-04 18:36 ` sashiko-bot
2026-12-04 19:15 ` Dave Hansen
2026-12-04 22:02 ` Edgecombe, Rick P
2026-12-04 21:44 ` Adrian Hunter
2026-12-04 22:04 ` Edgecombe, Rick P
2026-12-04 18:18 ` [PATCH v3 2/8] x86/virt/tdx: Add interface to check quoting capabilities Peter Fang
2026-12-04 18:44 ` sashiko-bot
2026-12-04 18:18 ` [PATCH v3 3/8] KVM: TDX: Require at least one quoting session and thread per CPU Peter Fang
2026-12-04 18:44 ` sashiko-bot
2026-12-04 18:18 ` [PATCH v3 4/8] KVM: TDX: Add KVM_TDX_GET_QUOTE sub-ioctl for quoting Peter Fang
2026-12-04 18:51 ` sashiko-bot
2026-12-04 18:18 ` [PATCH v3 5/8] KVM: TDX: Report maximum Quote size in TDX capabilities Peter Fang
2026-12-04 18:18 ` [PATCH v3 6/8] KVM: TDX: Document KVM_TDX_GET_QUOTE Peter Fang
2026-12-04 18:36 ` sashiko-bot [this message]
2026-12-04 18:18 ` [PATCH v3 7/8] x86/virt/tdx: Enable the quoting extension Peter Fang
2026-12-04 18:52 ` sashiko-bot
2026-12-04 18:18 ` [PATCH v3 8/8] x86/virt/tdx: Add documentation for DICE-based quoting Peter Fang
2026-12-04 18:40 ` [PATCH v3 0/8] Enable DICE-based TDX quoting Jason Gunthorpe
2026-12-04 18:47 ` Edgecombe, Rick P
2026-12-04 18:50 ` Jason Gunthorpe
2026-12-04 19:11 ` Edgecombe, Rick P
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=sashiko-outbox-250434@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=peter.fang@intel.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox