From patchwork Wed Jun 12 20:27:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cabaj X-Patchwork-Id: 1947113 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vzxtk1h9Rz20Pb for ; Thu, 13 Jun 2024 06:27:57 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sHUZO-0000f6-Lh; Wed, 12 Jun 2024 20:27:46 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sHUZN-0000ep-7D for kernel-team@lists.ubuntu.com; Wed, 12 Jun 2024 20:27:45 +0000 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id B725F3FE0F for ; Wed, 12 Jun 2024 20:27:44 +0000 (UTC) Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6b071ad9164so2299486d6.2 for ; Wed, 12 Jun 2024 13:27:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718224064; x=1718828864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gpU4RN4z4GFxhELb0R37G1B44ru5qINUuI6xdhV3UM8=; b=SQhfWuOC1jcPS+1cwrWimTznEDTux+UgX4pDdcbse4yeHnLw6tStGM2aCvSCZj15Rw AaAyn92ZK0H1uE7sw3UOqSbrzY04c0hP25VDz60wf4W1CmY/ydIG+urFQwsCpy5n7s9Q VWg/cNpCCeFkOFuZ8XxDu0B0/j69d5Mp5SDoyKlo0PUqSiQqDw4Uu25oeoORz5IUaMpL E+W+6nOoNJYJg8V15Zcs5iZd6RgMA2YR61Iko0T7bViNEn4LpCZw7MxfscHuowBd/jlB q2HprA0GQ1/CNSdXffdBpkdErdw0/Ryq/mJ81LalgITdOSnYn5wIDInIfs45sCYorZ21 CEvg== X-Gm-Message-State: AOJu0Yxc9eV8y0s71anFd/JswZIFHrK2onObJ/Y/ENzjTBRoXppbXcGt jJFcBu015aJMvu+IuZFpXuN+vnBia43x5XPFgrWxV7yIrUs+2Dbxd4aI9jPVfDf8Y2x/8BymQQS SwM7TgRfsENpnxn6w1qRsJQKoJp9I7KHUfpduFFudD5aF5mwj/vhJ4Nb/ELPBDPNNOiJzYJ1Me3 KLXcWbV3jVQQ== X-Received: by 2002:a05:6214:2dca:b0:6b0:74e1:4153 with SMTP id 6a1803df08f44-6b1b5b135e4mr25466356d6.64.1718224063413; Wed, 12 Jun 2024 13:27:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELhwIj52Me/X/B8NOmNyKUJ3XTeffigWoprXpywkLjwgOYzFdx/3C4WzMz644FLv5Z6Xvn1A== X-Received: by 2002:a05:6214:2dca:b0:6b0:74e1:4153 with SMTP id 6a1803df08f44-6b1b5b135e4mr25465896d6.64.1718224061722; Wed, 12 Jun 2024 13:27:41 -0700 (PDT) Received: from smtp.gmail.com (h208-73-92-250.mdtnwi.broadband.dynamic.tds.net. [208.73.92.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b0665b021bsm54118216d6.92.2024.06.12.13.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 13:27:41 -0700 (PDT) From: John Cabaj To: kernel-team@lists.ubuntu.com Subject: [SRU][n:linux-azure][PATCH 1/1] UBUNTU: SAUCE: x86/hyperv: temporarily disable CET SS on SEV-SNP due to a paravisor bug Date: Wed, 12 Jun 2024 15:27:39 -0500 Message-Id: <20240612202739.25050-2-john.cabaj@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240612202739.25050-1-john.cabaj@canonical.com> References: <20240612202739.25050-1-john.cabaj@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Dexuan Cui BugLink: https://bugs.launchpad.net/bugs/2069204 See the comment in the change for details. The paravisir would be fixed by Oct 2024, so the patch would become unnecessary after Oct 2024. Originally-by: Vitaly Kuznetsov Signed-off-by: Dexuan Cui (cherry picked from commit cdf5cdde07a0389525328379c4813d9620ed40ea https://github.com/dcui/linux) Signed-off-by: John Cabaj --- arch/x86/kernel/cpu/mshyperv.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 82a356fbde4e..c9dee20fa8a9 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -581,6 +581,27 @@ static void __init ms_hyperv_init_platform(void) if (!(ms_hyperv.features & HV_ACCESS_TSC_INVARIANT)) mark_tsc_unstable("running on Hyper-V"); + /* + * Mask CET Shadow Stack on SEV-SNP due to a CPUID emulation bug in + * the paravisor on old Azure SEV-SNP hosts, e.g., 10.0.20348.2867-2-0. + * Due to the bug, paranoid_xstate_size_valid() in a v6.6 or newer + * kernel prints a warning "XSAVE consistency problem: size 848 != kernel_size 832" + * and the kernel disables XSAVE completely; the early 'init' program or + * any later program may get core-dumped due to "invalid opcode", if + * they assume XSAVE is available (e.g., it looks like + * libgnutls.so.30.27.0 tries to unconditionally use XSAVE. + * + * Note: the SNP paravisor bug only affects a v6.6+ Linux kernel + * (CET Shadow Stack is firstly enabled in v6.6) when the VM is a "v5" + * SNP VM on Azure. A "v6" SNP VM is not affected, and a TDX VM is also + * not affectd since the versions of paravisor for them are already + * fixed. The fix for the "v5" VMs would roll out around September or + * October, 2024. + */ + if (ms_hyperv.paravisor_present && + hv_get_isolation_type() == HV_ISOLATION_TYPE_SNP) + setup_clear_cpu_cap(X86_FEATURE_SHSTK); + hardlockup_detector_disable(); }