From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61A6738E8B1 for ; Wed, 1 Jul 2026 20:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782936475; cv=none; b=lS9JdtkHYtmHkD9/SpHySYnyQN4sus1D92nUS4TZElX1Oeti0AC0JrZXNceGN/Ug9zKI8XSUTbb4Mcs+vLATwaaVd8Mw2ww1K0sfqzpVZMOUEUirXtXVI6gm2cu0OTqnYymLlO8lRZCwOVyjqsNXKFYywj9j2o89S6TV8pwvPBo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782936475; c=relaxed/simple; bh=1pQS/g2MnpCZt3mZlreri9StbMherxh7veCc3q9wdMg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ce5ypacWNbR1iA1ZDQbq6c4uenWVNU6Nq2mdCcN6IhTSYoblbHvPTWBfmnN9I9L+X6VKGmkqylnDecZ/ElocWrCnelAFOyj2OPQj7hj0laJz8VSVgoUXNR/wVA/PSyq0wF7YWMPmRzcIUSuF5HG4xwks0APAlUVppAQvQONiFlw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=age5iemQ; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="age5iemQ" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-37fee8a7813so1024370a91.1 for ; Wed, 01 Jul 2026 13:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782936473; x=1783541273; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=UOdt1MjTdK+8K0oNK35IqiS1Sh21G9xWYtRVhtEsR+w=; b=age5iemQ+lW3Q2il0OGh0+iwxFs7T+8pqH4hclXRDwTxbJQlZLCUDcE4khVlEJ00NG WdTMafVZfPRrTb8j+xfMGDvz51ApbFZEYZVLZsKWBja2D7rLDI9YrcGMPQM7hcPDzOOF suT36ashffyrnkcQ+J/Ul8+cfmiEWXBFjOiydcm439Mz2oCgbCH3JQhJki7F6DK/qpqA q9UQQLC+tMSSthmDWBaUyPODs5vAAvEdefcoA9ChjSNRLqqUce6B0a3uCTI4YUWPtwT/ RjuUtBP6yzXBJ5J3PMA3d3iOboH12vtIyEB9Ob5SuPhfVTTLGEqvc/hbPcpiBnUzgQIY IdNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782936473; x=1783541273; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=UOdt1MjTdK+8K0oNK35IqiS1Sh21G9xWYtRVhtEsR+w=; b=W2lX7tPDAxIdoocJjdx3yEEsSmbZphUQX0CWHTXLbVp1shYNqtYg8c+laNI/Xs873J /SZg2hitUgVm0NDayjYADE35iljKuDJ82TPZN9qXgELI3EFzQZeiRHHmcZP9OtD9AXY3 laSV2DNix9tb4If0BPA++TJwPvhLM/mdsPxOm6IvUY07AR4N4d4vdf2dJmoRZCchxV3j 02hMRU+S3yVrYQ5GN+31s3i2yGEKDfPmdpC9rrPJI9g3Ub4vN+CNF1r8MgUAdVG2k0M1 SUWKy2LhHYGaf+gj4vX+VhUAHQGbEyKO335z37qCKcbKtklIdVqW4Vga4ZE6SRBaHev+ g25g== X-Forwarded-Encrypted: i=1; AHgh+Rpir/OXHly4ttpWPge/E15vpAPB1KCOgrzR7ngoVR3stb83v/pUnBqzHcwtvQS+ltYhW9E=@vger.kernel.org X-Gm-Message-State: AOJu0YzdbbQv0JkuJfYH85ErWbDbuVzFfOtM19kSbFdliLRRE5CUlDn0 G5qKUz/qheDjeaMKI00vt+PkSwXufEvFOq5DD1uFyOmOGeSbTJY1sk21dquo5/HxVQjsvgBarOx vukTJkw== X-Received: from pjam22.prod.google.com ([2002:a17:90a:1596:b0:37c:c540:67c4]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:264a:b0:37f:9ce0:af35 with SMTP id 98e67ed59e1d1-380aa227dd0mr2771100a91.32.1782936473365; Wed, 01 Jul 2026 13:07:53 -0700 (PDT) Date: Wed, 1 Jul 2026 13:07:52 -0700 In-Reply-To: <20260701195652.5DEF11F000E9@smtp.kernel.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260701193212.749551-1-seanjc@google.com> <20260701193212.749551-6-seanjc@google.com> <20260701195652.5DEF11F000E9@smtp.kernel.org> Message-ID: Subject: Re: [PATCH v5 05/51] x86/sev: Mark TSC as reliable when configuring Secure TSC From: Sean Christopherson To: sashiko-reviews@lists.linux.dev Cc: linux-hyperv@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Wed, Jul 01, 2026, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 2 potential issu= e(s) to consider: > commit cdbd80de837f6d512a759452a18164ddd83b9b7b > Author: Sean Christopherson >=20 > x86/sev: Mark TSC as reliable when configuring Secure TSC >=20 > This commit moves the setting of the X86_FEATURE_TSC_RELIABLE flag from > sme_early_init() to snp_secure_tsc_init(). It consolidates the handling o= f > known-frequency and reliable TSC flags when overriding the TSC calibratio= n > routine. >=20 > [Severity: High] > This isn't a bug introduced by this patch, but does the early return in > arch/x86/kernel/tsc.c:tsc_early_init() allow an untrusted hypervisor to > bypass Secure TSC initialization? >=20 > The tsc_early_init() function checks is_early_uv_system() before initiali= zing > Secure TSC. The is_early_uv_system() check relies on the presence of > UV_SYSTEM_TABLE_GUID in the EFI configuration tables. >=20 > Because the hypervisor can provide tables to the guest firmware which may > expose them as EFI configuration tables, an untrusted hypervisor could in= ject > this specific GUID. Would this trick the kernel into returning early, > bypassing both Secure TSC and TDX TSC initialization, and causing the gue= st > to fall back to untrusted legacy timers? I suppose so? But that's a problem best handled in a dedicated, separate p= atch. >=20 > [Severity: High] > This is also a pre-existing issue, but should the newly updated > arch/x86/coco/sev/core.c:snp_secure_tsc_init() validate that the calculat= ed > frequency is non-zero before returning? >=20 > If the calculated frequency evaluates to 0, which could happen if the > hypervisor causes MSR_AMD64_GUEST_TSC_FREQ to read as 0 or if the secrets > factor is invalid, the function simply returns 0 instead of terminating > the VM. The hypervisor can't do that? If it can, that too should be addressed sepa= rately. > The caller tsc_early_init() treats a return value of 0 as a failure to fi= nd > a trusted frequency and gracefully falls back to x86_init.hyper.get_tsc_k= hz() > or legacy timers. In a confidential computing threat model, should this > security-critical initialization fail closed and terminate the VM, rather > than falling back to the hypervisor-controlled time sources that Secure T= SC > is designed to protect against? >=20 > --=20 > Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260701193212.74= 9551-1-seanjc@google.com?part=3D5