Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2416209lqt; Mon, 22 Apr 2024 10:02:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVIoAODefJSUU+Ogod1RZJxeurUboL3Ziu0J5hZm/tRzUlSRVQJwwJkZrNPvtK9GR6WCHZLx6m3UHaRNlnUB4+EtBcj0AxGs2hUn0xLSg== X-Google-Smtp-Source: AGHT+IHkmikYeUODziTBZ7qQjbYFYk2bndPKW02f7z+R+5e++ug5Wx9jEL0NiYSbHHai5XmbuMXU X-Received: by 2002:a17:906:1845:b0:a58:7172:1ab0 with SMTP id w5-20020a170906184500b00a5871721ab0mr208508eje.16.1713805327353; Mon, 22 Apr 2024 10:02:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713805323; cv=pass; d=google.com; s=arc-20160816; b=KD9OrYPKoUx/q7Do8QsQ9jnEtZX39DD/3/MnmYP2O9dPoiDDfP0VTMpEL3p5MFQwJ9 ++QAeYmP5gilBvXT+msrGdVKuibLIfGk4xTHwq1p4pQevDCu6yu7R+BO/U4a73C3TRdm XAFzCa3UUNIRB07cOXTbqTW362XPRYzelqcmKsjrjrPzNkJy4OOkjM/zJD61ryYQB0xD pd/jf3Br+5UnDII7hnF57bhP1PUOXB2yRwv7d9ldIpIgLUK0BZdEpWJiVUmqbwSfFV5/ 6A6D9ZdOIbRohaxUUBjAYRLLKW6ZDwSQi9VYhX/uW0GAJagwwir0TsvcXemxlWMiXSM3 i/Hg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=p4zvUu6nM9Son2hrQTKw+7zRLF0suhhHlCs6iZIU4Pg=; fh=Xi+WReo1vRbc0tmLnxHzjtVwrJe3+PSRi3c87fXUVWA=; b=JWanWAmwqY6V0YCfxKmMBNblvbwu2kTwYS9/jPLkQdwdq5GFqiqj4cIfP5R4t6lJp7 XOTg/1w9mePJSKfLOq7bXRCYbARW950R5/uq1MusqS+U4xMoWBLcw1l6erGZlX5XqyIV u6dzf0WqldFnflkX8PdC/VzU+BcR4XY0mN6SlpzkQuIeLY+XHChNdGMMLgE9NzBpx5HO 0cSsZ3XXZPTublRgS9I3pDb0O/j58sLQzm1W4HVJAhZkvpIHjEQlp/6OcbwN3n55WpvI FdKKPUhcRsn82sfRYYvldP/X6rNCst7/ysUtlUq5E9uFpQuyJvSfXoqUuxaV+es0PbHf FMBw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xirwMpvt; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-153776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153776-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id js5-20020a17090797c500b00a55af14b444si2126672ejc.96.2024.04.22.10.02.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 10:02:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xirwMpvt; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-153776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153776-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 635D61F21CF3 for ; Mon, 22 Apr 2024 17:02:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11159153BED; Mon, 22 Apr 2024 16:59:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xirwMpvt"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="HDQOyNI5" 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 B94C315574D; Mon, 22 Apr 2024 16:59:11 +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=1713805153; cv=none; b=aVZu6w0ePTOzZFzuYUB1fBsCScRTtKgIvu0z5795ZQa8vyF4TJoK2wc0lXNM16N+NClv0jHXoQVILQRlICahKblCJXqZo0tzWnupgUu6d0QBgvMUueLIoeaCezTCNfLcFE/zDTuBzeP01MboJo3p1eYwVlTMkPpe3jCxeeUaK44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713805153; c=relaxed/simple; bh=LfruV1Hguo4mvDNEJitoxYBqUeomvtwEh/ARyD1kwuY=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=mr7mNeca/Ipbb9YRmR0zwBNdzW0Zac4a6OUBd024ZW8kqpgN7GNfrVOrAaeumvgVE1u8phPl4OPZtCdm7Af1z3TgRI6HOYtri/HEZbGGTnCKnYuP5Fdgy9zGqKWDbSOSfJD11kuPmPjfwhieCUsE/fyVQC7r7EdxI985zNlwjqw= 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=xirwMpvt; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=HDQOyNI5; 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 Date: Mon, 22 Apr 2024 16:59:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713805149; 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: in-reply-to:in-reply-to:references:references; bh=p4zvUu6nM9Son2hrQTKw+7zRLF0suhhHlCs6iZIU4Pg=; b=xirwMpvtQ6JwG2kHDPcH7q4oL8xBRRT5Z5c3gnIC8q7GfCyfN2/+YjD0TQaI5FgT/FhiQa bp1GXLIqt31PHsOCvyCNZuNYXmuwtquzWRx4Nc9x1bxIuDqkoV/LMWsjlpt70cYdfBVfNx +2Li4tCqeLkwoGc2Gs7MzK/VKW+JiRO+7g6/cIHVwc7Ye+kdbEY9hyes9avhe/i/FaLi3T 7k4A1nut6tuVG39LpiK56ymKLZilATUm69iCO2oYtRiOEGG29l86rUeXFfx8DCUjfjOVvk 0wKx8OkZNk32yB93mOQvgYgYgHBSCvWN5PllklcuGAmxFTUhk3IRlZtUXX75hw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713805149; 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: in-reply-to:in-reply-to:references:references; bh=p4zvUu6nM9Son2hrQTKw+7zRLF0suhhHlCs6iZIU4Pg=; b=HDQOyNI5mFHV62Md0VP7mbKngTq/F1xUGBe6CEGx2lBLmplCkqFzuZYX3kaY0vyTnf345O 9TTZfFatEYPN1KCA== From: "tip-bot2 for Tom Lendacky" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/sev: Check for MWAITX and MONITORX opcodes in the #VC handler Cc: Tom Lendacky , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3C453d5a7cfb4b9fe818b6fb67f93ae25468bc9e23=2E17137?= =?utf-8?q?93161=2Egit=2Ethomas=2Elendacky=40amd=2Ecom=3E?= References: =?utf-8?q?=3C453d5a7cfb4b9fe818b6fb67f93ae25468bc9e23=2E171379?= =?utf-8?q?3161=2Egit=2Ethomas=2Elendacky=40amd=2Ecom=3E?= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171380514854.10875.17134181849297868311.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: 7bit The following commit has been merged into the x86/urgent branch of tip: Commit-ID: e70316d17f6ab49a6038ffd115397fd68f8c7be8 Gitweb: https://git.kernel.org/tip/e70316d17f6ab49a6038ffd115397fd68f8c7be8 Author: Tom Lendacky AuthorDate: Mon, 22 Apr 2024 08:39:21 -05:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 22 Apr 2024 18:38:28 +02:00 x86/sev: Check for MWAITX and MONITORX opcodes in the #VC handler The MWAITX and MONITORX instructions generate the same #VC error code as the MWAIT and MONITOR instructions, respectively. Update the #VC handler opcode checking to also support the MWAITX and MONITORX opcodes. Fixes: e3ef461af35a ("x86/sev: Harden #VC instruction emulation somewhat") Signed-off-by: Tom Lendacky Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/453d5a7cfb4b9fe818b6fb67f93ae25468bc9e23.1713793161.git.thomas.lendacky@amd.com --- arch/x86/kernel/sev-shared.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c index 8b04958..b4f8fa0 100644 --- a/arch/x86/kernel/sev-shared.c +++ b/arch/x86/kernel/sev-shared.c @@ -1203,12 +1203,14 @@ static enum es_result vc_check_opcode_bytes(struct es_em_ctxt *ctxt, break; case SVM_EXIT_MONITOR: - if (opcode == 0x010f && modrm == 0xc8) + /* MONITOR and MONITORX instructions generate the same error code */ + if (opcode == 0x010f && (modrm == 0xc8 || modrm == 0xfa)) return ES_OK; break; case SVM_EXIT_MWAIT: - if (opcode == 0x010f && modrm == 0xc9) + /* MWAIT and MWAITX instructions generate the same error code */ + if (opcode == 0x010f && (modrm == 0xc9 || modrm == 0xfb)) return ES_OK; break;