Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp605230iog; Wed, 15 Jun 2022 08:33:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t4ECidSlGILpINsuJcjKF6VJsVorwTO4KUPSCNBr7jEav863DZ4ck/6XSPBzqzcDwg9N1E X-Received: by 2002:a17:906:74c7:b0:711:fa45:4f88 with SMTP id z7-20020a17090674c700b00711fa454f88mr334042ejl.347.1655307189922; Wed, 15 Jun 2022 08:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655307189; cv=none; d=google.com; s=arc-20160816; b=N0yq+0c1ZeqDX4Iq6/oktLPtuTSuUI79gX0BTCESX0GrhdHm4PYlZlGvab5hIuTJTA h5mL0OMfdNeJgDTukQffWSRrbB1rMnuooZZo4S41GRv5vyxusHvIHAse5nGIrbVBEZYT ml/ba5O68NA2mj9H+ai+/wvdA8GtWa9jfqN+xs7Hy19INpIGP3iy9wY+ETQRs37n7pSi D2pzSzv9Gg6shekA69LCwqwk33FGjqeR+yV+PFDVx8Y7qB+J/bqCASwW6Qbp2h/MXnb/ 0stA4vtnK461rl0zujlTkeiyPs/5BhMJHICeVoOA0ICBetJudw6/wwgRZPH/cSAIIc/A 1mTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=uDnwEJncdrktO8Ww9Xoi6Txt+V0Sj+u0CUQU265KJC8=; b=pZEaiy0dyT0RbFvyo5C0GiIuLkAsp+79uysU6qHSiuATNXb6lqRgx4WrbDn9B5o+pu rdEloQMrfXr5xZJrTinyzcswLT6VW/ItGCC7BD4ymEFKt3YWbbDWKZJjwVu/MfigTe/9 G3I41HmU9jIH6NMsPxtqbV8kaFwwbEdPwuHDECcWlvmMTqLA8cjbISwuZW27NmRJy6qU I/eGZfUAc4ZIOSzqb0rJdmWaixmq8hRfK4Z6DMeGy6kOwIZAMxNuon7KHcuMZfmZcf8W bhxC3sX7Cn3JX4kWlgGFqjCKhViBRt8yJI5Jod56j+Wo5Eom1xpqvql1wOYzyMZovXQM bxMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mAjhabvq; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f25-20020a056402005900b0042aae0c55c3si13435702edu.224.2022.06.15.08.32.42; Wed, 15 Jun 2022 08:33:09 -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=mAjhabvq; 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 S1354712AbiFOPaK (ORCPT + 99 others); Wed, 15 Jun 2022 11:30:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355717AbiFOP2l (ORCPT ); Wed, 15 Jun 2022 11:28:41 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D45BA434AB for ; Wed, 15 Jun 2022 08:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655306872; x=1686842872; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=SRHdAt5c+iG6nC47CDkQ4xDzPy+xva5pr4/9bMvN8yc=; b=mAjhabvq/AesKvcCgutZ+c4HI0NUJ6gNbGOrE3HAmY2cSXR4q11hPD9h GJS+kaPdqwip/JbRtxOYLCMSEtluGD9Yf8rxyxzAgtmTmjts8SceM+QEX Kmrcprv8X2LOydUcB3fI5GH52jirS42aOYlEq/UoVrarC0Z2bXD3+1EWz 0Rz06jjm4t5IKvjap17TNIjXq7HedGY+NYt+JYXnq3uMrVEHQOmloZ7+Y kzMrypW9uEclJWlMyMQp92DZF1dVSW6jhMLFWRP4fK9uWPIa5OGlygINf gdiono5sPR5lRqj3ecZjRpiX79yXzj2bECG/EV8pOictGezciHRoPni6M w==; X-IronPort-AV: E=McAfee;i="6400,9594,10378"; a="340656982" X-IronPort-AV: E=Sophos;i="5.91,302,1647327600"; d="scan'208";a="340656982" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2022 08:27:52 -0700 X-IronPort-AV: E=Sophos;i="5.91,302,1647327600"; d="scan'208";a="559173120" Received: from mjortiz-mobl.amr.corp.intel.com (HELO [10.212.185.241]) ([10.212.185.241]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2022 08:27:52 -0700 Message-ID: <051fd468-11e6-308b-66c8-4de16ff80deb@intel.com> Date: Wed, 15 Jun 2022 08:27:52 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCHv4 3/3] x86/tdx: Handle load_unaligned_zeropad() page-cross to a shared page Content-Language: en-US To: "Kirill A. Shutemov" , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, luto@kernel.org, peterz@infradead.org Cc: ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, sathyanarayanan.kuppuswamy@linux.intel.com, seanjc@google.com, thomas.lendacky@amd.com, x86@kernel.org References: <20220614120135.14812-1-kirill.shutemov@linux.intel.com> <20220614120135.14812-4-kirill.shutemov@linux.intel.com> From: Dave Hansen In-Reply-To: <20220614120135.14812-4-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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 On 6/14/22 05:01, Kirill A. Shutemov wrote: > load_unaligned_zeropad() can lead to unwanted loads across page boundaries. > The unwanted loads are typically harmless. But, they might be made to > totally unrelated or even unmapped memory. load_unaligned_zeropad() > relies on exception fixup (#PF, #GP and now #VE) to recover from these > unwanted loads. > > In TDX guests, the second page can be shared page and VMM may configure > it to trigger #VE. > > Kernel assumes that #VE on a shared page is MMIO access and tries to > decode instruction to handle it. In case of load_unaligned_zeropad() it > may result in confusion as it is not MMIO access. > > Fix it by detecting split page MMIO accesses and fail them. > load_unaligned_zeropad() will recover using exception fixups. > > The issue was discovered by analysis. It was not triggered during the > testing. I thought this whole exercise was kicked off by hitting this in testing. Am I remembering this wrong? > https://lore.kernel.org/all/20220517153444.11195-10-kirill.shutemov@linux.intel.com/ Says: > This is an actual, real-world problem which was discovered during TDX > testing. Or were you considering this a different problem somehow?