From nobody Sun May 24 19:34:48 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D5E9369224; Fri, 22 May 2026 17:26:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470773; cv=none; b=rWRmqruV5vpMjn6JVp2EUV0y1Q985XNim5OwO8EtZyLz/JlwLoq2Mx0szTS2U1GGb7P21pauIDIh24QbBmv/OMShJ4hRAVIqvQUsW35TVudEkInYoqMLP3X13sFZDTnCN86CZLLWf36C7Am3VAXtfzczrZaYB4IVI04hL0+3Hf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470773; c=relaxed/simple; bh=+5IlIgLFwDPpx/BtlfofaY5UCMinnYIviOqV3et9f3o=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=Q6rQjZmv97VE0lFdFLso1aHJsgODWMDdKZ6KFbk8MckPlZNLrf1iq8gfZhMnBatOts03YHUNJpUcg6mrGuRF51zeSH8Gdvl8yVFBlb9Wprj+08vi0RHlWrBxxU1T2qxg3rKfxwLe0g5mLLOaEfTl4SO6MRlrT0l8ir/UAvpZqHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=V0z2BvUt; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=S310YHs/; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="V0z2BvUt"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="S310YHs/" Date: Fri, 22 May 2026 17:26:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779470770; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aTSMo3ZFCCy9w0BVd9TrrXbHcPy6GZ4Adc8adhQ1o78=; b=V0z2BvUtW7HOrAdUuDiW/TzgXSX7xmS+9FCOvANee5Vq0ddnPOFBa+sU+xePDR65Iy/qLK cBDuaf9ewBQhopTWV4u6pcV8RRnlcZVGcSOy6V8slDgymKanmLZiELMI456fDzq3wCaihN DRA5FRY8LgwZ/eltAY12Hwzmp72Y1rbQVfblIZoe80Wkx5O9SrHhKFoGJrYt//0N1FVAG4 k8dLes/SPXa/TzPpDELMZYdeaFh+MTAFXDA4D/1shh5/preZwWvBH9tjX+Bo5X4bTV8vAl 1IWi0FlSecyzLr1K24ptXhBAkoILNqGVTEsH/z1jbDLVj1Q5BtlwAoeQqz9+5w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779470770; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aTSMo3ZFCCy9w0BVd9TrrXbHcPy6GZ4Adc8adhQ1o78=; b=S310YHs/hNNPPc42GeHnjCbNxvNytNhVQAVhcrRXxh5NFMUOd+sJLuzZXXXcspLxNGemCM cw1vixV8T+qe6nAA== From: "tip-bot2 for Dave Hansen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/tdx] x86/virt/seamldr: Add module update locking Cc: Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177947076930.711.17805133039901507053.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/tdx branch of tip: Commit-ID: 6693d4c89e884a1e277cac31a396afbfb3210327 Gitweb: https://git.kernel.org/tip/6693d4c89e884a1e277cac31a396afbfb= 3210327 Author: Dave Hansen AuthorDate: Fri, 22 May 2026 08:43:02 -07:00 Committer: Dave Hansen CommitterDate: Fri, 22 May 2026 10:20:08 -07:00 x86/virt/seamldr: Add module update locking TDX metadata like the version number changes during a module update. Add functions to lock out module updates. The current stop_machine() implementation uses worker threads. The scheduler actually does a full, normal context switch over to that thread. preempt_disable() obviously inhibits that context switch and thus, locks out stop_machine() users like the module update. Signed-off-by: Dave Hansen --- arch/x86/include/asm/seamldr.h | 2 ++ arch/x86/virt/vmx/tdx/seamldr.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/arch/x86/include/asm/seamldr.h b/arch/x86/include/asm/seamldr.h index 43084e2..cfc6a1b 100644 --- a/arch/x86/include/asm/seamldr.h +++ b/arch/x86/include/asm/seamldr.h @@ -32,5 +32,7 @@ static_assert(sizeof(struct seamldr_info) =3D=3D 256); =20 int seamldr_get_info(struct seamldr_info *seamldr_info); int seamldr_install_module(const u8 *data, u32 data_len); +void seamldr_lock_module_update(void); +void seamldr_unlock_module_update(void); =20 #endif /* _ASM_X86_SEAMLDR_H */ diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamld= r.c index f5591d7..b1137ca 100644 --- a/arch/x86/virt/vmx/tdx/seamldr.c +++ b/arch/x86/virt/vmx/tdx/seamldr.c @@ -350,3 +350,19 @@ out: return ret; } EXPORT_SYMBOL_FOR_MODULES(seamldr_install_module, "tdx-host"); + +/* + * stop_machine() does not interrupt preemption-disabled regions. + * Simply disabling preempt prevents updates. + */ +void seamldr_lock_module_update(void) +{ + preempt_disable(); +} +EXPORT_SYMBOL_FOR_MODULES(seamldr_lock_module_update, "tdx-host"); + +void seamldr_unlock_module_update(void) +{ + preempt_enable(); +} +EXPORT_SYMBOL_FOR_MODULES(seamldr_unlock_module_update, "tdx-host");