Re: [RFC PATCH 02/15] x86/tdx: Add TDCM hypercall wrapper for TDX Connect
From: Xiaoyao Li
Date: Tue Oct 27 2026 - 01:51:05 EST
On 10/27/2026 11:28 AM, Duan, Zhenzhong wrote:
>>> Abstract the underlying leaf call and pass the shared buffer physical
>>> address as a decrypted mapping. Add a runtime page alignment check
>>> for the buffer to enforce correct usage.
>> This doesn't match the implementation. The code only WARNs instead of
>> enforcing
>> correct usage.
> You mean below code?
>
> static void tdx_devsec_unlock(struct pci_tsm *tsm)
> {
> struct tdx_devsec *tdevsec = to_tdx_devsec(tsm);
> struct device_evidence *evidence = tsm->evidence;
>
> if (WARN_ON(tdx_tdi_unbind_dev(tdevsec)))
> return;
>
> I think the unlock() callback should be defined with a return value so
> userspace could catch the error.
No. I meant just the code of tdx_hcall_tdcm()
+u64 tdx_hcall_tdcm(u16 devid, void *buf, size_t size, u8 vector)
+{
+ WARN_ON_ONCE(!PAGE_ALIGNED(buf) || !PAGE_ALIGNED(size));
+
+ return _tdx_hypercall(TDVMCALL_TDCM, devid, cc_mkdec(virt_to_phys(buf)), size,
vector);
+}
it warns on the unaligned buf and size, but the unaligned data are still consumed.