From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAD3BC433E0 for ; Wed, 17 Feb 2021 12:02:34 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 613EF64E5B for ; Wed, 17 Feb 2021 12:02:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 613EF64E5B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=8bytes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 21FC36F629 for ; Wed, 17 Feb 2021 12:02:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E_tqe0KMxlg3 for ; Wed, 17 Feb 2021 12:02:33 +0000 (UTC) Received: by smtp3.osuosl.org (Postfix, from userid 1001) id F3E306F603; Wed, 17 Feb 2021 12:02:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTP id 1EF756F5F0; Wed, 17 Feb 2021 12:02:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E1754C0174; Wed, 17 Feb 2021 12:02:17 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6B880C08A1 for ; Wed, 17 Feb 2021 12:02:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5433387239 for ; Wed, 17 Feb 2021 12:02:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uXqSbhd1qdYt for ; Wed, 17 Feb 2021 12:02:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from theia.8bytes.org (8bytes.org [81.169.241.247]) by hemlock.osuosl.org (Postfix) with ESMTPS id 77CEA86F98 for ; Wed, 17 Feb 2021 12:02:12 +0000 (UTC) Received: from cap.home.8bytes.org (p549adcf6.dip0.t-ipconnect.de [84.154.220.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id 2E8D9246; Wed, 17 Feb 2021 13:02:08 +0100 (CET) From: Joerg Roedel To: x86@kernel.org Subject: [PATCH 0/3] x86/sev-es: Check for trusted regs->sp in __sev_es_ist_enter() Date: Wed, 17 Feb 2021 13:01:40 +0100 Message-Id: <20210217120143.6106-1-joro@8bytes.org> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Cc: kvm@vger.kernel.org, Peter Zijlstra , Dave Hansen , virtualization@lists.linux-foundation.org, Arvind Sankar , hpa@zytor.com, Jiri Slaby , Joerg Roedel , David Rientjes , Martin Radev , Tom Lendacky , Joerg Roedel , Kees Cook , Cfir Cohen , Andy Lutomirski , Dan Williams , Juergen Gross , Mike Stunes , Sean Christopherson , linux-kernel@vger.kernel.org, Masami Hiramatsu , Erdem Aktas X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" From: Joerg Roedel Hi, here are some changes to the Linux SEV-ES code to check whether the value in regs->sp can be trusted, before checking whether it points to the #VC IST stack. Andy Lutomirski reported that it is entirely possible to reach this function with a regs->sp value which was set by user-space. So check for this condition and don't use regs->sp if it can't be trusted. Also improve the comments around __sev_es_ist_enter/exit() to better explain what these function do and why they are there. Please review. Thanks, Joerg Joerg Roedel (3): x86/sev-es: Introduce from_syscall_gap() helper x86/sev-es: Check if regs->sp is trusted before adjusting #VC IST stack x86/sev-es: Improve comments in and around __sev_es_ist_enter/exit() arch/x86/include/asm/ptrace.h | 8 ++++++++ arch/x86/kernel/sev-es.c | 27 +++++++++++++++++++-------- arch/x86/kernel/traps.c | 3 +-- 3 files changed, 28 insertions(+), 10 deletions(-) -- 2.30.0 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization