Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp909226pxb; Thu, 21 Oct 2021 11:49:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFNmAcKbky90sjtg7OblaMt8dL47eTuRXdGgWi95UhnyAvlZhEVqf6mpRJCaO93pEiu5hq X-Received: by 2002:a05:6402:4248:: with SMTP id g8mr9833127edb.126.1634842141477; Thu, 21 Oct 2021 11:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634842141; cv=none; d=google.com; s=arc-20160816; b=nCTE4GAL8HdpNjEWL4kImVeVNG395M2D03eijRU3WUvi9aVyisXs4DPfz3RVK7/b1Z /dlwCKRO2x7ymXf2CY3duNIPSxp/A3Qbd1tCoNf4hDUrBXEET5b30I2Qxj/F+8P7wrAw RcCLNX4myJX6sNFH5wVe6axeCGLBOtymBw/DrZbkbwEJ8ybb4ETSDo94YScooGILrtlq 2vhjTpJmeSiZ+JpeJb75mfcsiDYrSx1DWHXtqCHrTMUq/Oy/vXTM7uo2XMHkJ7Fyeqz5 afXy1gOFRglBTODYZn1Pl8/nI5JSkhB2fjNKsbcIWFPuv8eg+xVkr8ba8ikNkCJJEjvy 0RzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WvxWgq2dLAGqen8UM31jjC2Q8Nfg2PZVc4rOcpkz+RQ=; b=DRGWkC5s4gzXjWXvo2reNErDZb4VHaQrKcSlYAgTixFp6GBT/dpAYf2yi3fGLEot8y JeSJUmg3v0nnCWMxW6IDW7wO5GEBkrGy9GX1WjkELWE8RCYWKOkA1wNGiLBzvAJ/lA2S hRucWtZnfDj86u3Yhx1sSfVsxwfM/hakaLGKBxiJwmWZDIsMuEb5QACSMDBfm9AmT5zb 7Es2JSXK5i7kB6U/6Ch9npdt8WPiRlDHemS3BXmIG5Qae5s8r3bM81uaFxV8pxpZuijY 2vaxBZoQAHuQGlJhsNXKMyHFzD7Ar0LUJZaxXBCIPg27AyxER/2itvFpN3Odv5QJM0Mt VxLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=TabvkIr+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si8146399eja.442.2021.10.21.11.48.36; Thu, 21 Oct 2021 11:49:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=TabvkIr+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232296AbhJUSsu (ORCPT + 99 others); Thu, 21 Oct 2021 14:48:50 -0400 Received: from mail.skyhub.de ([5.9.137.197]:39864 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbhJUSst (ORCPT ); Thu, 21 Oct 2021 14:48:49 -0400 Received: from zn.tnic (p200300ec2f1912005c22c248f35985a5.dip0.t-ipconnect.de [IPv6:2003:ec:2f19:1200:5c22:c248:f359:85a5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id DF4681EC053B; Thu, 21 Oct 2021 20:46:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1634841992; h=from:from: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:in-reply-to:in-reply-to: references:references; bh=WvxWgq2dLAGqen8UM31jjC2Q8Nfg2PZVc4rOcpkz+RQ=; b=TabvkIr+qmtR55/vwHcln6Rs8ye3YUSx9Dog/d2cXtpz1H4TnQNoL9czyC7cFT+ujxLj0B cZfWEH+Var/MpHaA0blwxefl9GWCYta5nWH3/guDkDjWtCVLZpnZukGu/mc4DX54BQoph+ yDf69FlEAUe5W1ly8gCa/HifIYG1APE= Date: Thu, 21 Oct 2021 20:46:30 +0200 From: Borislav Petkov To: "Dr. David Alan Gilbert" Cc: Michael Roth , Brijesh Singh , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v6 08/42] x86/sev-es: initialize sev_status/features within #VC handler Message-ID: References: <20211018184003.3ob2uxcpd2rpee3s@amd.com> <20211020161023.hzbj53ehmzjrt4xd@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 06:47:50PM +0100, Dr. David Alan Gilbert wrote: > Hang on, I think it's perfectly fine for it to clear that bit - it just > gets caught if it *sets* it (i.e. claims to be a chip unaffected by the > bug). > > i.e. if guestval=0 then (GustVal & whatever) == GuestVal > fine > > ? Bah, ofc. The name of the bit is NullSelectorClearsBase - so when it is clear, we will note we're affected, as that patch does: + /* + * CPUID bit above wasn't set. If this kernel is still running + * as a HV guest, then the HV has decided not to advertize + * that CPUID bit for whatever reason. For example, one + * member of the migration pool might be vulnerable. Which + * means, the bug is present: set the BUG flag and return. + */ + if (cpu_has(c, X86_FEATURE_HYPERVISOR)) { + set_cpu_bug(c, X86_BUG_NULL_SEG); + return; + } I have managed to flip the meaning in my mind. Ok, that makes more sense. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette