Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2391776rwd; Wed, 17 May 2023 09:17:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42ecFQCtpRDNQX3OLb7P3JrzwvKN8CfoXRSsOPGahDGhQEUSz5maQo/0PCQIb+3t+z3PuR X-Received: by 2002:a05:6a21:6d9a:b0:100:607:b997 with SMTP id wl26-20020a056a216d9a00b001000607b997mr48223550pzb.49.1684340248753; Wed, 17 May 2023 09:17:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684340248; cv=pass; d=google.com; s=arc-20160816; b=YYk9GZloJfdTD3mZKZpNZmZGPzS0aJA7FIvdbhKqQ8AAiOzhYF/Xgf16aER33hbmUa a2atQcHdc8ivqR0Z8dBj3Hfcw1WiDPT3ZyHyzLuvK+bZdwVfaBnzb34rYhG+PhYAkcWg VXQLbg8BfVWuBIpcQ8GWURIvhumWQnfp9e1QKVWivRpXRGy3c8AecZ90LuRbRBiHS+LP k6yPaF1SVCoPfasW0zQL69waVsvoBj0cVgWou4cwkZzfljaIbcEN+vXEm6QRbucEZMmw JRW8Xm/T5WBvZVF3Qg0eOVKeeZPZJy6Frzn6lgpWWOEX8MMXMwkieq75O7qYlaHkorP9 YX6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=hAt9fFoHWB1YevfNwALXh6vikrAD5FxXl9rcOVC2/Y0=; b=F01Fn5VzTYIwq+RnVGrrLGUHAdNBruPfFZ3U9VrYx+Zt8PL9siABENVQQ3Y0yWnUq0 JBPMxE5TA04rRWByBmglmgS3avkUa8XONM6ekkjMyW2/Xrkw6UgSTeGJHF+0wui4Way7 k9sdh10x4YBkVQOyOvWotL6SG/kdAPpEhZZh0yYkU8XOrWhAxME5g8Mu2t9dLxQQ09uH /88zfpyXzbMxu29LWXz9HfM2W0zJxIGTexdiIjoh18s/KxryTMlSOmpg03aD7tuXvRBH CsO+novN2FIsaFAP5//BUkBcskAn+gNOVF6yhNvTW4dMh9JZqbIgtXzTP/W7qQ/WFKE+ dkEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=eUXxP5Np; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a17090a8c8c00b0024e0758c190si2038651pjo.27.2023.05.17.09.17.15; Wed, 17 May 2023 09:17:28 -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=@amd.com header.s=selector1 header.b=eUXxP5Np; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231442AbjEQQHq (ORCPT + 99 others); Wed, 17 May 2023 12:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230109AbjEQQHo (ORCPT ); Wed, 17 May 2023 12:07:44 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2057.outbound.protection.outlook.com [40.107.237.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 028392691; Wed, 17 May 2023 09:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nH1kqrb5A1GXJe02/R0Dwlq54y/1I7RnqHCAmgsKexTs06uTFT90W1iXz958Dxf7a9Zs3RNjxAMe7Od4Gp6iQFhTyclVLm1Id1kUz5o2H07nA/ieyurPvnSEJQ6RVesxn9I2G7hU6V0GYc66k/+ny1D6EW7sQLXT4EWlc3WXsgSVWHMJupsOUFpMz1SzwWvSPGr8kOAAQqkarjBcDHpE/qLns6stKuO95khnKmcyritNuAC3LwavTynf6zcs0rkP2Y35CXrEds9O2hcJm+FZvJg+kh36sczssa1MQUX3UTIqDfRio2v0BAEofvKKOD6rfudnG047yOIY3T7VJBx5yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hAt9fFoHWB1YevfNwALXh6vikrAD5FxXl9rcOVC2/Y0=; b=ZnUnirX8Megj3SxgN5A7uI9ZJs5XSsaHcOra+GQulSzL5KlrGQEZn2le5Ouh0Y64+WdrLnIhroGM3m/OjrZG7xu1CqB8yrKcPyd7K1ZqmkflLfd+kW3WzxxQhFAqypDLLwrSp71x3neoxe2vYUEj1EDlKTZ1+BbT1HGLy7wiLi6w2r3UUlmrpVEsr7LYxzFxwJVuCViXDCzQNRcQ8Fe3J2tBLOTEDebjEL8OHpxSQTV6HKPbRk2aMTnQoK0VcVfLDME6jHAoYctqKDhXQQ7+ETbMDJSj1CQc9VKc+KbYx0GwHCpSfdh+amUqYXjWeyW6jQIGwYHmdV7J9WNDBEkoow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hAt9fFoHWB1YevfNwALXh6vikrAD5FxXl9rcOVC2/Y0=; b=eUXxP5NponnxdInpaqs4xbT8Yj9BoB+0rrJylN/Z5O32LK7EbIJdKo2YTlOGFFeU4UeJGMl/pnCRPDZuCtBU7caLLSdMHSENrdssp7k7Wwb/mnkH/QMS4h/alkVnq9JmJMwSVS6BNch6ZW/D/dYr/j3wtkFtxsIrUhJGEBT6yns= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by MW6PR12MB8662.namprd12.prod.outlook.com (2603:10b6:303:243::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Wed, 17 May 2023 16:07:38 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::ea32:baf8:cc85:9648]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::ea32:baf8:cc85:9648%7]) with mapi id 15.20.6411.017; Wed, 17 May 2023 16:07:38 +0000 Message-ID: Date: Wed, 17 May 2023 11:07:35 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCHv11 6/9] efi/unaccepted: Avoid load_unaligned_zeropad() stepping into unaccepted memory Content-Language: en-US To: "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Dave Hansen , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Dario Faggioli , Mike Rapoport , David Hildenbrand , Mel Gorman , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, aarcange@redhat.com, peterx@redhat.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Dave Hansen References: <20230513220418.19357-1-kirill.shutemov@linux.intel.com> <20230513220418.19357-7-kirill.shutemov@linux.intel.com> From: Tom Lendacky In-Reply-To: <20230513220418.19357-7-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SN6PR05CA0013.namprd05.prod.outlook.com (2603:10b6:805:de::26) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR12MB5229:EE_|MW6PR12MB8662:EE_ X-MS-Office365-Filtering-Correlation-Id: 61af4214-89cd-49bd-46f8-08db56f0d5ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xLnmybtU2lKiCW6nbCVMgaEwJIhmydMBJHseqVHsrN7lbnum2v/RUGDHjydyJLmp7HGRnSn8YU17SzXRCvBRhGqh7cGG03K4+X2/R8chjfXcIEmXIYmqmmdIhGaNJH6IfSpqhl5g9f0Js+He1vzAmNPiZBBY/QhlqKTYz0v5jJEPr4Me3iHHePHXieKT0uLnZ2xS67NoLFx2o8T7sHOri59BmEoHAio7m7CfivBNtB99PNtXXthLVrd/05XfgqhVd1AZ6r7vzDjIZK5Amx44quKJB9hvkJKe204hdRXnM7kEgVV74YrFoC4miMf/vDqojPh2CX91U/CrRG7P1NAWqwRtjWV2dRenRohfMTi5X0ET3ZQKgZ8o6YYZ1T9ROwU/2Pq+2eGaRFGgw4oUP1zEzAgAO7kiT1t4em9BGqytmTeKPPVg4GlXGXBRFJU04/6RQvg8wM25f7oS0zyIFPMyJkv0Z1Bnx4xRj7QObB/dB3hjKuMATV8laENe/Du8U1GSxz2Tb/ilgT8bFutgdc7W4ucscPP4/hufZzt19z8K51N4fJCCutopiwSErbUiskn2HT+r1kZ90pIeuIjTQ2DjLL/S1IIGNl9TTHJfoIKZlKziJDhPHpbCqIyPN13ToWhgP4tdlbKX4UBR5IF2SPgqYA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(136003)(366004)(376002)(346002)(451199021)(66946007)(31686004)(2906002)(7416002)(7406005)(83380400001)(5660300002)(8936002)(8676002)(66476007)(110136005)(54906003)(66556008)(41300700001)(316002)(478600001)(6486002)(36756003)(4326008)(6666004)(2616005)(53546011)(31696002)(26005)(6512007)(6506007)(186003)(86362001)(38100700002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SmVKTjA5Yzg1blJ1REtjNzJlRjdZZzRROTVHSTZ3T1Z2VHBRdllaL3lNaUt3?= =?utf-8?B?MENrTi8vR3NVRXQ1L2hmZVJKamZHQml5WWd1Y0RoL2RrWTUrd2x0ZTc5YmJz?= =?utf-8?B?NE1rSGp5WXZoRXBDTWlZY3ROanpzcEZ4VnBQQnBUQkNzbHBVbmZldXdLNVdy?= =?utf-8?B?MTQxUEdMMWJmN1JIS0F6VGhIbXpScjI2bmhUZWZBZEgwQWRkcUI4cmF5eGp3?= =?utf-8?B?N0RCZFpwSUZicHh5SEVLRkg1T1FTNG4yU0R2OFkrb0Q0UEJoQ2l3VzdOVytm?= =?utf-8?B?REpzUTZtdkdZZWdqTURCVmNH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VJzMVFiZEJQ?= =?utf-8?Q?37scOVuf4PftyG/y8uTojm0xg?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61af4214-89cd-49bd-46f8-08db56f0d5ee X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 16:07:38.7071 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Lv4xJHu3F3YF7ehtmve+xdjqrWb4qxvDeQXeLGE7TPYLHzvNiP85bOsRr73jQH+Z3W7Xww9SwG834SPNEIHMvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8662 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 5/13/23 17:04, 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. > > But, this approach does not work for unaccepted memory. For TDX, a load > from unaccepted memory will not lead to a recoverable exception within > the guest. The guest will exit to the VMM where the only recourse is to > terminate the guest. > > There are two parts to fix this issue and comprehensively avoid access > to unaccepted memory. Together these ensure that an extra "guard" page > is accepted in addition to the memory that needs to be used. > > 1. Implicitly extend the range_contains_unaccepted_memory(start, end) > checks up to end+unit_size if 'end' is aligned on a unit_size > boundary. > 2. Implicitly extend accept_memory(start, end) to end+unit_size if 'end' > is aligned on a unit_size boundary. > > Side note: This leads to something strange. Pages which were accepted > at boot, marked by the firmware as accepted and will never > _need_ to be accepted might be on unaccepted_pages list > This is a cue to ensure that the next page is accepted > before 'page' can be used. > > This is an actual, real-world problem which was discovered during TDX > testing. > > Signed-off-by: Kirill A. Shutemov > Reviewed-by: Dave Hansen Reviewed-by: Tom Lendacky > --- > drivers/firmware/efi/unaccepted_memory.c | 35 ++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/drivers/firmware/efi/unaccepted_memory.c b/drivers/firmware/efi/unaccepted_memory.c > index bb91c41f76fb..3d1ca60916dd 100644 > --- a/drivers/firmware/efi/unaccepted_memory.c > +++ b/drivers/firmware/efi/unaccepted_memory.c > @@ -37,6 +37,34 @@ void accept_memory(phys_addr_t start, phys_addr_t end) > start -= unaccepted->phys_base; > end -= unaccepted->phys_base; > > + /* > + * 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. > + * > + * But, this approach does not work for unaccepted memory. For TDX, a > + * load from unaccepted memory will not lead to a recoverable exception > + * within the guest. The guest will exit to the VMM where the only > + * recourse is to terminate the guest. > + * > + * There are two parts to fix this issue and comprehensively avoid > + * access to unaccepted memory. Together these ensure that an extra > + * "guard" page is accepted in addition to the memory that needs to be > + * used: > + * > + * 1. Implicitly extend the range_contains_unaccepted_memory(start, end) > + * checks up to end+unit_size if 'end' is aligned on a unit_size > + * boundary. > + * > + * 2. Implicitly extend accept_memory(start, end) to end+unit_size if > + * 'end' is aligned on a unit_size boundary. (immediately following > + * this comment) > + */ > + if (!(end % unit_size)) > + end += unit_size; > + > /* Make sure not to overrun the bitmap */ > if (end > unaccepted->size * unit_size * BITS_PER_BYTE) > end = unaccepted->size * unit_size * BITS_PER_BYTE; > @@ -84,6 +112,13 @@ bool range_contains_unaccepted_memory(phys_addr_t start, phys_addr_t end) > start -= unaccepted->phys_base; > end -= unaccepted->phys_base; > > + /* > + * Also consider the unaccepted state of the *next* page. See fix #1 in > + * the comment on load_unaligned_zeropad() in accept_memory(). > + */ > + if (!(end % unit_size)) > + end += unit_size; > + > /* Make sure not to overrun the bitmap */ > if (end > unaccepted->size * unit_size * BITS_PER_BYTE) > end = unaccepted->size * unit_size * BITS_PER_BYTE;