* [PATCH v2] x86/tdx: Harden exports
@ 2026-09-17 11:07 Nikolay Borisov
2026-09-18 9:36 ` Peter Fang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Nikolay Borisov @ 2026-09-17 11:07 UTC (permalink / raw)
To: dave.hansen
Cc: rick.p.edgecombe, xiaoyao.li, linux-coco, kvm, x86,
Nikolay Borisov, Michal Koutný
tdx_* function aren't supposed to be used by the kernel at large, rather
they are mostly used by KVM and a very small number of them are exposed
via the tdx-guest/tdx-host drivers. Reflect this fact in their
EXPORT_SYMBOL* declarations.
Reported-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
---
V2:
* Drop the change to tdx_kvm_hypercall
arch/x86/coco/tdx/tdx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
index f904a636d449..a38e44401840 100644
--- a/arch/x86/coco/tdx/tdx.c
+++ b/arch/x86/coco/tdx/tdx.c
@@ -139,7 +139,7 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport)
return 0;
}
-EXPORT_SYMBOL_GPL(tdx_mcall_get_report0);
+EXPORT_SYMBOL_FOR_MODULES(tdx_mcall_get_report0, "tdx-guest");
/**
* tdx_mcall_extend_rtmr() - Wrapper to extend RTMR registers using
@@ -175,7 +175,7 @@ int tdx_mcall_extend_rtmr(u8 index, u8 *data)
return 0;
}
-EXPORT_SYMBOL_GPL(tdx_mcall_extend_rtmr);
+EXPORT_SYMBOL_FOR_MODULES(tdx_mcall_extend_rtmr, "tdx-guest");
/**
* tdx_hcall_get_quote() - Wrapper to request TD Quote using GetQuote
@@ -196,7 +196,7 @@ u64 tdx_hcall_get_quote(u8 *buf, size_t size)
/* Since buf is a shared memory, set the shared (decrypted) bits */
return _tdx_hypercall(TDVMCALL_GET_QUOTE, cc_mkdec(virt_to_phys(buf)), size, 0, 0);
}
-EXPORT_SYMBOL_GPL(tdx_hcall_get_quote);
+EXPORT_SYMBOL_FOR_MODULES(tdx_hcall_get_quote, "tdx-guest");
static void __noreturn tdx_panic(const char *msg)
{
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] x86/tdx: Harden exports
2026-09-17 11:07 [PATCH v2] x86/tdx: Harden exports Nikolay Borisov
@ 2026-09-18 9:36 ` Peter Fang
2026-09-18 10:03 ` Nikolay Borisov
2026-09-25 7:42 ` Nikolay Borisov
2026-09-25 11:19 ` Kiryl Shutsemau
2 siblings, 1 reply; 6+ messages in thread
From: Peter Fang @ 2026-09-18 9:36 UTC (permalink / raw)
To: Nikolay Borisov
Cc: dave.hansen, rick.p.edgecombe, xiaoyao.li, linux-coco, kvm, x86,
Michal Koutný
On Thu, Sep 17, 2026 at 02:07:14PM +0300, Nikolay Borisov wrote:
> tdx_* function aren't supposed to be used by the kernel at large, rather
> they are mostly used by KVM and a very small number of them are exposed
> via the tdx-guest/tdx-host drivers. Reflect this fact in their
"exposed via" sounds a bit off? Perhaps "exposed to"?
And this patch only touches functions exported to tdx-guest... In fact
tdx-host only uses functions from arch/x86/virt/vmx/tdx/ (guest code vs
host code). Maybe the log could be a bit more precise.
> EXPORT_SYMBOL* declarations.
>
> Reported-by: Michal Koutný <mkoutny@suse.com>
> Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
> ---
>
> V2:
> * Drop the change to tdx_kvm_hypercall
>
> arch/x86/coco/tdx/tdx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] x86/tdx: Harden exports
2026-09-18 9:36 ` Peter Fang
@ 2026-09-18 10:03 ` Nikolay Borisov
2026-09-18 20:25 ` Peter Fang
0 siblings, 1 reply; 6+ messages in thread
From: Nikolay Borisov @ 2026-09-18 10:03 UTC (permalink / raw)
To: Peter Fang
Cc: dave.hansen, rick.p.edgecombe, xiaoyao.li, linux-coco, kvm, x86,
Michal Koutný
On 18.09.26 г. 12:36 ч., Peter Fang wrote:
> On Thu, Sep 17, 2026 at 02:07:14PM +0300, Nikolay Borisov wrote:
>> tdx_* function aren't supposed to be used by the kernel at large, rather
>> they are mostly used by KVM and a very small number of them are exposed
>> via the tdx-guest/tdx-host drivers. Reflect this fact in their
>
> "exposed via" sounds a bit off? Perhaps "exposed to"?
What I meant was that the functionality of those functions is exposed
via the tdx-guest/tdx-host drivers. I.e those drivers present interfaces
to userspace to enable them to use the functionality of said functions.
I.e those functions are only used by those drivers.
>
> And this patch only touches functions exported to tdx-guest... In fact
> tdx-host only uses functions from arch/x86/virt/vmx/tdx/ (guest code vs
> host code). Maybe the log could be a bit more precise.
Fair point.
>
>> EXPORT_SYMBOL* declarations.
>>
>> Reported-by: Michal Koutný <mkoutny@suse.com>
>> Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
>> ---
>>
>> V2:
>> * Drop the change to tdx_kvm_hypercall
>>
>> arch/x86/coco/tdx/tdx.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] x86/tdx: Harden exports
2026-09-18 10:03 ` Nikolay Borisov
@ 2026-09-18 20:25 ` Peter Fang
0 siblings, 0 replies; 6+ messages in thread
From: Peter Fang @ 2026-09-18 20:25 UTC (permalink / raw)
To: Nikolay Borisov
Cc: dave.hansen, rick.p.edgecombe, xiaoyao.li, linux-coco, kvm, x86,
Michal Koutný
On Fri, Sep 18, 2026 at 01:03:46PM +0300, Nikolay Borisov wrote:
>
>
> On 18.09.26 г. 12:36 ч., Peter Fang wrote:
> > On Thu, Sep 17, 2026 at 02:07:14PM +0300, Nikolay Borisov wrote:
> > > tdx_* function aren't supposed to be used by the kernel at large, rather
> > > they are mostly used by KVM and a very small number of them are exposed
> > > via the tdx-guest/tdx-host drivers. Reflect this fact in their
> >
> > "exposed via" sounds a bit off? Perhaps "exposed to"?
>
> What I meant was that the functionality of those functions is exposed via
> the tdx-guest/tdx-host drivers. I.e those drivers present interfaces to
> userspace to enable them to use the functionality of said functions. I.e
> those functions are only used by those drivers.
Ah I see. Maybe a tiny bit of polishing would be enough. Thanks.
>
>
> >
> > And this patch only touches functions exported to tdx-guest... In fact
> > tdx-host only uses functions from arch/x86/virt/vmx/tdx/ (guest code vs
> > host code). Maybe the log could be a bit more precise.
>
> Fair point.
>
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] x86/tdx: Harden exports
2026-09-17 11:07 [PATCH v2] x86/tdx: Harden exports Nikolay Borisov
2026-09-18 9:36 ` Peter Fang
@ 2026-09-25 7:42 ` Nikolay Borisov
2026-09-25 11:19 ` Kiryl Shutsemau
2 siblings, 0 replies; 6+ messages in thread
From: Nikolay Borisov @ 2026-09-25 7:42 UTC (permalink / raw)
To: Rick Edgecombe, kas@kernel.org
Cc: xiaoyao.li, linux-coco, kvm, x86, Michal Koutný, Dave Hansen
On 17.09.26 г. 14:07 ч., Nikolay Borisov wrote:
> tdx_* function aren't supposed to be used by the kernel at large, rather
> they are mostly used by KVM and a very small number of them are exposed
> via the tdx-guest/tdx-host drivers. Reflect this fact in their
> EXPORT_SYMBOL* declarations.
>
> Reported-by: Michal Koutný <mkoutny@suse.com>
> Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
Gentle ping
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] x86/tdx: Harden exports
2026-09-17 11:07 [PATCH v2] x86/tdx: Harden exports Nikolay Borisov
2026-09-18 9:36 ` Peter Fang
2026-09-25 7:42 ` Nikolay Borisov
@ 2026-09-25 11:19 ` Kiryl Shutsemau
2 siblings, 0 replies; 6+ messages in thread
From: Kiryl Shutsemau @ 2026-09-25 11:19 UTC (permalink / raw)
To: Nikolay Borisov
Cc: dave.hansen, rick.p.edgecombe, xiaoyao.li, linux-coco, kvm, x86,
Michal Koutný
On Thu, Sep 17, 2026 at 02:07:14PM +0300, Nikolay Borisov wrote:
> tdx_* function aren't supposed to be used by the kernel at large, rather
> they are mostly used by KVM and a very small number of them are exposed
> via the tdx-guest/tdx-host drivers. Reflect this fact in their
> EXPORT_SYMBOL* declarations.
Subject could be better. Something like "x86/tdx: Restrict attestation
exports to the tdx-guest driver"?
The changelog still talks about KVM and tdx-host. Rewrite it.
> Reported-by: Michal Koutný <mkoutny@suse.com>
Maybe Suggested-by rather than Reported-by? There is no bug here.
> Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
With that fixed you can use my:
Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
--
Kiryl Shutsemau / Kirill A. Shutemov
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-25 11:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 11:07 [PATCH v2] x86/tdx: Harden exports Nikolay Borisov
2026-09-18 9:36 ` Peter Fang
2026-09-18 10:03 ` Nikolay Borisov
2026-09-18 20:25 ` Peter Fang
2026-09-25 7:42 ` Nikolay Borisov
2026-09-25 11:19 ` Kiryl Shutsemau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox