linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-coco@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/coco, x86/sev: Use cpu_feature_enabled() to detect SEV guest flavor
Date: Tue, 5 Dec 2023 18:00:12 +0300	[thread overview]
Message-ID: <20231205150012.6lma2wzcellr7pz7@box.shutemov.name> (raw)
In-Reply-To: <20231205144619.GCZW83uzAomKmupn7j@fat_crate.local>

On Tue, Dec 05, 2023 at 03:46:19PM +0100, Borislav Petkov wrote:
> On Tue, Dec 05, 2023 at 05:37:38PM +0300, Kirill A. Shutemov wrote:
> > The SEV code uses cc_platform_has() checks to detect the SEV flavor.
> > However, these checks can sometimes produce false positives depending on
> > the context.
> > 
> > For example, sev_map_percpu_data() uses CC_ATTR_GUEST_MEM_ENCRYPT to
> > detect SEV guest, but this check will also pass for TDX guests.
> 
> Well, a function prefixed with "sev_" should check cc_vendor first...

I don't think cc_platform_has() is the right check. On TDX side we use
X86_FEATURE_TDX_GUEST for this and it works better than stretching
CC_ATTRs beyond their meaning.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

  reply	other threads:[~2023-12-05 15:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 14:37 [PATCH] x86/coco, x86/sev: Use cpu_feature_enabled() to detect SEV guest flavor Kirill A. Shutemov
2023-12-05 14:46 ` Borislav Petkov
2023-12-05 15:00   ` Kirill A. Shutemov [this message]
2023-12-05 15:06     ` Borislav Petkov
2023-12-05 15:14       ` Kirill A. Shutemov
2023-12-05 16:00         ` Borislav Petkov
2023-12-05 17:16           ` Kirill A. Shutemov
2023-12-05 17:24             ` Borislav Petkov
2023-12-05 18:08               ` Kirill A. Shutemov
2023-12-05 18:52                 ` Borislav Petkov
2023-12-05 20:33                   ` Borislav Petkov
2024-01-02 12:22                     ` Kirill A. Shutemov
2024-01-02 12:30                       ` Borislav Petkov
2023-12-05 17:27           ` Jeremi Piotrowski
2023-12-05 17:12 ` kernel test robot
2023-12-05 19:24 ` kernel test robot

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=20231205150012.6lma2wzcellr7pz7@box.shutemov.name \
    --to=kirill.shutemov@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).