All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chao Gao" <chao.gao@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v6 07/22] coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updates
Date: Thu, 13 Aug 2026 22:52:23 +0000	[thread overview]
Message-ID: <20260813225224.543991F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260326084448.29947-8-chao.gao@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The module pins itself in memory and becomes permanently un-unloadable due to a reference cycle.
- [Medium] seamldr_init() failure propagates to tdx_host_probe() and fails the whole tdx-host module.
--

--- Patch [7]: [PATCH v6 07/22] coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updates ---
commit 805f010d78ca6bd2ca042a5f57d4d4c84f3c2978
Author: Chao Gao <chao.gao@intel.com>

coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updates

This patch introduces a sysfs ABI using the fw_upload framework to allow 
userspace to provide TDX module updates. It explicitly chooses fw_upload
over request_firmware() to give userspace full control over module
versioning and non-linear update policies.

> diff --git a/drivers/virt/coco/tdx-host/tdx-host.c b/drivers/virt/coco/tdx-host/tdx-host.c
> index 01f68c390a49e..d4a5528530211 100644
> --- a/drivers/virt/coco/tdx-host/tdx-host.c
> +++ b/drivers/virt/coco/tdx-host/tdx-host.c
[ ... ]
> +static int seamldr_init(struct device *dev)
> +{
> +	struct fw_upload *tdx_fwl;
> +
> +	if (!can_expose_seamldr())
> +		return 0;
> +
> +	tdx_fwl = firmware_upload_register(THIS_MODULE, dev, "tdx_module",
> +					   &tdx_fw_ops, NULL);

[Severity: High]
Passing THIS_MODULE to firmware_upload_register() increments the module's 
reference count. 

Since tdx-host uses a root faux_device without a sysfs unbind mechanism, 
the elevated reference count will cause rmmod to always fail with -EBUSY. 

Does this effectively pin the module in memory permanently and prevent updates 
without rebooting? Should this pass NULL instead of THIS_MODULE to avoid the 
reference cycle?

> +	if (IS_ERR(tdx_fwl))
> +		return PTR_ERR(tdx_fwl);
> +
> +	return devm_add_action_or_reset(dev, seamldr_deinit, tdx_fwl);
> +}

[Severity: Medium]
The v3 changelog mentions "Don't fail the whole tdx-host device if 
seamldr_init() met an error", but returning the errors here propagates them 
back to tdx_host_probe(). 

This causes the entire tdx-host module initialization to fail if the optional 
firmware upload interface fails to register. 

Did this inadvertently revert the v3 design intent? Should this function
ignore these errors and return 0 instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260326084448.29947-1-chao.gao@intel.com?part=7

  reply	other threads:[~2026-08-13 22:52 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26  8:43 [PATCH v6 00/22] Runtime TDX module update support Chao Gao
2026-03-26  8:43 ` [PATCH v6 01/22] x86/virt/tdx: Move low level SEAMCALL helpers out of <asm/tdx.h> Chao Gao
2026-03-31  9:51   ` Xiaoyao Li
2026-03-26  8:43 ` [PATCH v6 02/22] coco/tdx-host: Introduce a "tdx_host" device Chao Gao
2026-03-31 10:07   ` Xiaoyao Li
2026-03-26  8:43 ` [PATCH v6 03/22] coco/tdx-host: Expose TDX module version Chao Gao
2026-03-31 10:21   ` Xiaoyao Li
2026-03-26  8:43 ` [PATCH v6 04/22] x86/virt/seamldr: Introduce a wrapper for P-SEAMLDR SEAMCALLs Chao Gao
2026-03-31 10:23   ` Xiaoyao Li
2026-03-26  8:43 ` [PATCH v6 05/22] x86/virt/seamldr: Add a helper to retrieve P-SEAMLDR information Chao Gao
2026-03-31 10:25   ` Xiaoyao Li
2026-03-26  8:43 ` [PATCH v6 06/22] coco/tdx-host: Expose P-SEAMLDR information via sysfs Chao Gao
2026-03-30 12:41   ` Kiryl Shutsemau
2026-03-26  8:43 ` [PATCH v6 07/22] coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updates Chao Gao
2026-08-13 22:52   ` sashiko-bot [this message]
2026-03-26  8:43 ` [PATCH v6 08/22] x86/virt/seamldr: Allocate and populate a module update request Chao Gao
2026-03-30 12:44   ` Kiryl Shutsemau
2026-03-26  8:44 ` [PATCH v6 09/22] x86/virt/seamldr: Introduce skeleton for TDX module updates Chao Gao
2026-03-26 11:47   ` Chao Gao
2026-03-26  8:44 ` [PATCH v6 10/22] x86/virt/seamldr: Abort updates if errors occurred midway Chao Gao
2026-03-30 12:52   ` Kiryl Shutsemau
2026-03-26  8:44 ` [PATCH v6 11/22] x86/virt/seamldr: Shut down the current TDX module Chao Gao
2026-03-26  8:44 ` [PATCH v6 12/22] x86/virt/tdx: Reset software states during TDX module shutdown Chao Gao
2026-03-26 12:35   ` Chao Gao
2026-03-26  8:44 ` [PATCH v6 13/22] x86/virt/seamldr: Install a new TDX module Chao Gao
2026-03-30 12:59   ` Kiryl Shutsemau
2026-03-26  8:44 ` [PATCH v6 14/22] x86/virt/seamldr: Do TDX per-CPU initialization after updates Chao Gao
2026-03-26  8:44 ` [PATCH v6 15/22] x86/virt/tdx: Restore TDX module state Chao Gao
2026-03-26  8:44 ` [PATCH v6 16/22] x86/virt/tdx: Update tdx_sysinfo and check features post-update Chao Gao
2026-03-26 13:03   ` Chao Gao
2026-03-26  8:44 ` [PATCH v6 17/22] x86/virt/tdx: Avoid updates during update-sensitive operations Chao Gao
2026-03-30 13:07   ` Kiryl Shutsemau
2026-03-31  2:34     ` Chao Gao
2026-03-31 12:22       ` Kiryl Shutsemau
2026-03-26  8:44 ` [PATCH v6 18/22] coco/tdx-host: Don't expose P-SEAMLDR features on CPUs with erratum Chao Gao
2026-03-26  8:44 ` [PATCH v6 19/22] x86/virt/tdx: Enable TDX module runtime updates Chao Gao
2026-03-26  8:44 ` [PATCH v6 20/22] coco/tdx-host: Document TDX module update compatibility criteria Chao Gao
2026-03-26  8:44 ` [PATCH v6 21/22] x86/virt/tdx: Document TDX module update Chao Gao
2026-03-26  8:44 ` [PATCH v6 22/22] x86/virt/seamldr: Log TDX module update failures Chao Gao
2026-03-26  8:52 ` [PATCH v6 00/22] Runtime TDX module update support Chao Gao

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=20260813225224.543991F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chao.gao@intel.com \
    --cc=kvm@vger.kernel.org \
    --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 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.