From patchwork Mon Jun 26 19:30:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 113112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7721582vqr; Mon, 26 Jun 2023 13:01:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ieHLMwbFjAANgO3RoPhEsCGCv4EwpmzdBF1dNuMoiuL+eIVk0/JmZHA0atUfbYsy7RGSI X-Received: by 2002:a17:902:ec8f:b0:1b6:7db2:57dd with SMTP id x15-20020a170902ec8f00b001b67db257ddmr4787365plg.19.1687809667834; Mon, 26 Jun 2023 13:01:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687809667; cv=none; d=google.com; s=arc-20160816; b=gqVKzHrX6yjlp8JK+TeH0AW6lWdpaYqw762yiiyCh6ymYdJ0ORWRZupF/Pj+smBkxa 2KCOLQkAc1nXbdppj7UIcWSIsYPWYRSGmnAtVkI37Dn17TgyHCD/YpJVB8hp1dHxmNEN zj1OyHhfZ+3FdCJyfKVxrkZajwmUG0p/+5Bee0yZE/WQg+oKVfW51homsSjcJeBkXn4k DZRaunYjBYABf02tqn8j4zL7hzijWObfeCxQPVTIeN9lMD4SoOmdFEqdg/zJiu38mQfM Kb+VWJiTKq+WW7IwIdr/YZURsBj6zSFw6sAMiIqqexoVfk/6ZCTtd7QtUQVvnP6S1DeO PRog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fGGzAzTfHdHVN5y+l4Gb4kYkoulQVWyHDz7LhjyJDaI=; fh=WnlVi/Q/6zv0fZ6Ey9Krvq5QWByVvi9tb1A26EVXDkE=; b=vdR35sZ2o33SxaXJVnyNULUPbIZhG50FXukPiFC5gEeL926T8YvLd4V7R0XcaubfPz a8VRNSnnc9IsET3nX+sQ2zYZEXTQH8YsvmCMH7GjrLzq1ss0MSj2z398P4H8Sy5KjrPA qV50lAlIagZFykRwp4hbGk9JdYBGy5P9N3+y8TQt7YMHprM/D4q9lAgT9oqKY2iyumS0 7oJG90BgsTIy9SjSiq4Oz6sbDLgSuX75NEH9IK26IJ2lLvE1RDx/snUm6kXdTqE1bzRu OabfgR+sIkF5WuxXT5Ss8Gae9qnGuL+NZKcSE4XsE1TPA/aDJiA7q4wb19l+MqX+Cfj0 vTSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OfTmUMqu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k22-20020a170902761600b001b67185e39esi5224811pll.177.2023.06.26.13.00.54; Mon, 26 Jun 2023 13:01:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OfTmUMqu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbjFZTa5 (ORCPT + 99 others); Mon, 26 Jun 2023 15:30:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjFZTaz (ORCPT ); Mon, 26 Jun 2023 15:30:55 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBDD7E74 for ; Mon, 26 Jun 2023 12:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687807852; x=1719343852; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qEzo2K0bbHOwosWcye5uApxGCWDZFso+NzL92l7ysaA=; b=OfTmUMquH8vEcGQft0Far+hRW8cXJTGtxYffkKZ3vfMTp552nZpYe/4R WYhOiQfbTpiO0moAO8Y2s4Kn3esN5cZkZ8wYnSKGMpmA4kbYuPpqZ7jeR 8KR6NzZ35RDN152/4DmtC9jjPJ92KP0+AAECWCU3yiwIlGaSOszuCGRSg FJ7p3BP+uWGNW6hAfKNZ30xwDHYZaWhwVFPRAjloSuXjyz+4tzA/xvrrc 0BzlZu1gq/zwfzVk96dsRNnnKZBFwfHnxUfnygsGoQInMyr6dZw7y/YLg hFTwceNE9ixOv2a0BJBUNSHccZ1dqJcQ9XGKm2PiepxHye+a8gq+TnwQu w==; X-IronPort-AV: E=McAfee;i="6600,9927,10753"; a="340954351" X-IronPort-AV: E=Sophos;i="6.01,160,1684825200"; d="scan'208";a="340954351" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 12:30:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10753"; a="781572308" X-IronPort-AV: E=Sophos;i="6.01,160,1684825200"; d="scan'208";a="781572308" Received: from viggo.jf.intel.com (HELO ray2.intel.com) ([10.54.77.144]) by fmsmga008.fm.intel.com with ESMTP; 26 Jun 2023 12:30:52 -0700 From: Dave Hansen To: torvalds@linux-foundation.org Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Dave Hansen Subject: [GIT PULL] x86/tdx for 6.5 Date: Mon, 26 Jun 2023 12:30:50 -0700 Message-Id: <20230626193050.1532183-1-dave.hansen@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769796710104785916?= X-GMAIL-MSGID: =?utf-8?q?1769796710104785916?= Hi Linus, Please pull some x86/tdx changes for 6.5. This includes a very minor cleanup and a fix for a race. The race has never been observed in practice but might allow load_unaligned_zeropad() to catch a TDX page in the middle of its conversion process which would lead to a fatal and unrecoverable guest shutdown. --- The following changes since commit 44c026a73be8038f03dbdeef028b642880cf1511: Linux 6.4-rc3 (2023-05-21 14:05:48 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tags/x86_tdx_for_6.5 for you to fetch changes up to 94142c9d1bdf1c18027a42758ceb6bdd59a92012: x86/mm: Fix enc_status_change_finish_noop() (2023-06-06 16:24:27 -0700) ---------------------------------------------------------------- - Fix a race window where load_unaligned_zeropad() could cause a fatal shutdown during TDX private<=>shared conversion - Annotate sites where VM "exit reasons" are reused as hypercall numbers. ---------------------------------------------------------------- Kirill A. Shutemov (3): x86/mm: Allow guest.enc_status_change_prepare() to fail x86/tdx: Fix race between set_memory_encrypted() and load_unaligned_zeropad() x86/mm: Fix enc_status_change_finish_noop() Nikolay Borisov (1): x86/tdx: Wrap exit reason with hcall_func() arch/x86/boot/compressed/tdx.c | 4 +-- arch/x86/coco/tdx/tdx.c | 62 ++++++++++++++++++++++++++++++--------- arch/x86/include/asm/shared/tdx.h | 11 +++++++ arch/x86/include/asm/x86_init.h | 2 +- arch/x86/kernel/x86_init.c | 4 +-- arch/x86/mm/mem_encrypt_amd.c | 4 ++- arch/x86/mm/pat/set_memory.c | 3 +- 7 files changed, 69 insertions(+), 21 deletions(-)