Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp981873pxp; Wed, 16 Mar 2022 23:23:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfpF4FnpDes7+gp8+VDed9cAR7IPsHE2CG4dY1op5RzErLifc9PGrdjYL/jkhxS6MicqOL X-Received: by 2002:a17:903:204a:b0:153:a38b:977e with SMTP id q10-20020a170903204a00b00153a38b977emr3566025pla.126.1647498223938; Wed, 16 Mar 2022 23:23:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1647498223; cv=pass; d=google.com; s=arc-20160816; b=PC6YvKqOeq6pd5sm8LfJmeQmAcYbGRuIym+FURHynErHLkp24HLrQ/BhWnsJCH4O1Z g2ELhA8IAqgg1ChcKOgxuZ1rb62Z4QaUDQLmNDUZEBYuDGB86S15omKtMkv0cj5gskNy LrS0za53cafQEonjUbaNhbLuJk+OkoU7keAC0lxOYosQJi4NGq/cuLl88z6/qjOl66ln hqOrWqwaGJ9qr6mDDLDxsldofMCQMqlzXjAsVuLa9HWuNNScyyFxYAYBZz9HCAH6MrUD L5t9U17rUxRiw3yQuHnFViqg4PoKNCEBbxKiQ7SC78B/slcACHhFNuydBSVITRiQmNNr OQIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:from:references:cc:to :content-language:subject:user-agent:date:message-id:dkim-signature; bh=OghRy/ES1AdFHej/ll8v+y5J+wsWeIiBnNj2Yy5Mg/Y=; b=JfpAiIpXpPxaWpnBzdZ7iHHaVnYVeQhTBJJO4TLVk7nSjxF6twtgzhD79upm6NsQqp X9/a9EjuACof3qgYNTGLynNE10M3Eux5TyJVGvWxwfPUQD3apQIgOlA/xjZRUGTJUx9L bJcLUUi+G1lKjy/7dq6Ob2w1DFdY8uH5QZVdinHW5EjXmwcPCKqAbc4IGMnpnys11BdM 5zX7TDLZSxy7o7Hxailep+BMjwKhZAFbp2Ct3Sd7BljgKuhsLkHMAyoXpikumdmiGix+ M31FmzdqoC5UZx64AwBFEVPwcE4mflez+CuMhmE0jonRYOWN4bwTCp/7iLsU6pg1JLK3 TqWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fortanix.com header.s=selector1 header.b=Cy5hbQPr; arc=pass (i=1 spf=pass spfdomain=fortanix.com dkim=pass dkdomain=fortanix.com dmarc=pass fromdomain=fortanix.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fortanix.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id n17-20020a170902d2d100b001520c3aa621si4268054plc.413.2022.03.16.23.23.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 23:23:43 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@fortanix.com header.s=selector1 header.b=Cy5hbQPr; arc=pass (i=1 spf=pass spfdomain=fortanix.com dkim=pass dkdomain=fortanix.com dmarc=pass fromdomain=fortanix.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fortanix.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2EF5515B865; Wed, 16 Mar 2022 22:09:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354958AbiCPJrZ (ORCPT + 99 others); Wed, 16 Mar 2022 05:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354957AbiCPJrX (ORCPT ); Wed, 16 Mar 2022 05:47:23 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2098.outbound.protection.outlook.com [40.107.236.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29AB3654A0; Wed, 16 Mar 2022 02:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e7/RT6ExWhC9Fk3j7Kq6gC0AYBqvwXCzg9vLdsp+sGRkZUuvFJODjYhYZ4ITpLn2pPLandd0XJqpbaXOyOBGXX4C43mDeuCHCL20E7My2aup09YTYmAUf8HWgFs7txrAzo6E/vvmnrtvcYBfMltcp17z4jommljoXj26AqnP392drO2CRnqel91tBJJMRlYc+WtHZAQ7m+1995fUiBRlTuHEBs5UW/5efOiYTmxKPG+s1ztuIWSaJtjLz9JZtNy2iRsomivnTr6QPzaM5rghoufBaGzoAcNeEaDr6USzyrGFL97YRr+LOP9WBZ78V8J5irVVKF8M2QE5pxlGCqMEsQ== 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=OghRy/ES1AdFHej/ll8v+y5J+wsWeIiBnNj2Yy5Mg/Y=; b=M9Mbzhigb5fDx2y5biSOKa05XGDKmmfGNDOpMVVKkxpGJVV/uCZkRv11o1NQUnio7jXwzd81itzxpf4pOsaZoaLjNW4ixFAjiVX42GYnVU6Rs8G6+UHh2i1z+XWunfWhKtm4OSGAkpmcmCjPKqZDTAlHivnpwndN0j+rwoI947lgMSLiY1qcYLAmDgWtnH+d93SqrgO/ESXvJ190tEdRHVjdbVibhjk38DVSjmrceh59/uLhfgmxaSr9R+SSqgDY8u2WVgvZen63HKT3/tKaYeKlk1GDY7rpAl8ROD1BUlwQCOvb0u/mD9eWFiQWOKo3liPOnWxNTArl+agRQomVmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fortanix.com; dmarc=pass action=none header.from=fortanix.com; dkim=pass header.d=fortanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fortanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OghRy/ES1AdFHej/ll8v+y5J+wsWeIiBnNj2Yy5Mg/Y=; b=Cy5hbQPrq+uCTnupumvNMkl7El7arCJIDk7UQN/WnF2wbJQkmnU/X0cZUH9RZ0VZkfWTzIRq+prFlyBUotasoAr+wACL0YfjpKVZVkTHFs8iMH3Rwx+wRwXBBfd7FpWihaYfyP1gtY/j0aVwaSPZ8IQX8NUKSefPrhg11G+zkwg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=fortanix.com; Received: from PH0PR11MB5626.namprd11.prod.outlook.com (2603:10b6:510:ee::15) by CH0PR11MB5473.namprd11.prod.outlook.com (2603:10b6:610:d4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.15; Wed, 16 Mar 2022 09:46:05 +0000 Received: from PH0PR11MB5626.namprd11.prod.outlook.com ([fe80::919c:b806:f259:e276]) by PH0PR11MB5626.namprd11.prod.outlook.com ([fe80::919c:b806:f259:e276%5]) with mapi id 15.20.5081.016; Wed, 16 Mar 2022 09:46:05 +0000 Message-ID: <53e7d3a3-a576-7ef1-fa2d-d170fa1172a1@fortanix.com> Date: Wed, 16 Mar 2022 10:46:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [RFC PATCH v2 09/10] x86/cpu: Call ENCLS[EUPDATESVN] procedure in microcode update Content-Language: en-US To: Cathy Zhang , linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dave.hansen@intel.com, ashok.raj@intel.com References: <20220315010300.10199-1-cathy.zhang@intel.com> <20220315010300.10199-10-cathy.zhang@intel.com> From: Jethro Beekman In-Reply-To: <20220315010300.10199-10-cathy.zhang@intel.com> Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="------------ms000903000909070506060406" X-ClientProxiedBy: AM0PR04CA0005.eurprd04.prod.outlook.com (2603:10a6:208:122::18) To PH0PR11MB5626.namprd11.prod.outlook.com (2603:10b6:510:ee::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a7f48acc-92d0-4c3e-1fe5-08da0731ca06 X-MS-TrafficTypeDiagnostic: CH0PR11MB5473:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tt4u8SU+SNBrTht4zfR0zYwaVf0psfhGfrNLlo349Kc+te0oSGyaS87WW8qJijhoOVzeOpd2SYDleCRs084i17Zz9F+2kmqebXBQFpBPAYIlmWKfmSF7q5kiJTOoMUk4qNvtKIdS0mX0U+o0GCgjCfAotvBVcdACtU8ZLVrMfvx0vR942mz6nSR7g+4RXWBxi69rRX2AWgaw1MvY2YKkVf0v7K8uOgrMsdcc/NVsHTcm9uGTY1FIlvMA0sKNaWbsQH2lz8aB0lMmuJ7p1frn577xotWRFWB3upueNtqDMafgAdx/KrQHU7k6cQpVVdGlpccSCEbboOVyMcdOUA2KjoopatZRGZqSDBGO6iyj4RumuWSgha8/OBspQXYC6muuLWzSVy9HBiFH1rv+GdrbXlLMD20zqb4iLRWrXlOCSA4gaMYj9D7eDjnH41R+shaxI6niCFkCXKOMD0oS2blqNV3gLadylQRe1ifdZ3GLQ6gOFQPm45PFihk/VKQ9uKY8XbfTpx8+0mfAsfoBCD/yh6OOhx2itkiLVuS3kBvf1oVCY16E4ua2hJU23DScBBx/Nj0j9uiL1LYSHfCx4FZn/eORw2SGkIBZDSazlMqCv1G3WxWla6/Mps7i8+lYagIWpAT0o+5V9HPPl7GSLU8eecMNmoJULHRetWr0emNHZgFpEPYzPZb2Qmh7mA/BY1rtt71WXAR2aneNpR9hQ5pypojucahuEcy2rF93dz3N6VNpCCUBYczED3JewhAF26YD2rQACtildG9nAL5HVlN8FQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5626.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(508600001)(6512007)(6666004)(31686004)(36756003)(6486002)(6506007)(53546011)(33964004)(52116002)(26005)(186003)(2616005)(83380400001)(316002)(66476007)(66556008)(8676002)(4326008)(66946007)(2906002)(15650500001)(5660300002)(235185007)(8936002)(31696002)(38350700002)(86362001)(38100700002)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TUE5TlU4MWhBalRBWXpLMDVUKzBPQVRLOE42eDVZb0VjaElpNmtJeXd2WDJl?= =?utf-8?B?REhueXNOTFhXVGlibmNDQmhNcXVQQ1NHV1dvckFlYlVMNTdvSDEwS3ZDaW9M?= =?utf-8?B?K29Ib0FCd3podEkyVVdHRDVWSXF2QmcvSnVWRmtJaGlQNHFOUjZqSDZKMkx3?= =?utf-8?B?RTVyUHBxVmYwZElrZTd4QkhFQkZRMnBKUnN5QXBHdmNKcjB6UEVJTUxHbE9F?= =?utf-8?B?M1ZsZUQ5c2grWndoYWhQVUo3QWlXL25GUFZ4akRjUlovMU1RMnErTWs0TlBw?= =?utf-8?B?QnBjN21uNE9XdWwwN2Y2a2lkMHRtdWI5N2FaSHMw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1R1bHhWVkpxV2kvNlhpOXcwM3c3a2taNEwrMTc0?= =?utf-8?B?RWZxWW1GNXlacmZkeHhLMG9BamlTRlk4amNqb0ZMQ1pNVm1uQmJGN09RenNJ?= =?utf-8?B?bEtsamRqeVkvb1JubFAvZ3FrYTJYb2hFalhsNldRbk9UdHZQTFFwY010T0py?= =?utf-8?B?K3ZscU1QT3VjSHRoUlNqdG5PbThvN3VOeW9rL2pZa1F0NzF6U1RlQWlFMGZ0?= =?utf-8?B?ZlVQMlA2VFBLYXhzWGwxOHZDRDRKeUh4UXVTWDVTdE11dXFYc3dZek1yZWJW?= =?utf-8?B?OXNPMUlaK1E2NzMzWVAzTEcxbVFkQU5LNmRiWGZQU2xKQU1peG4vdmdDd3dw?= =?utf-8?B?bnJvVFF4MTg5YTVKUHpQa2dTSVRybitlS1RBUjRZYndDVWQrRVVEdjVOemZm?= =?utf-8?B?NTk2Y2NaemVXckZBclg0WXJyRVVIbVMva2haWWsxMXRRTm1LQ05jNEljRWgx?= =?utf-8?B?SUpKN3prWDlNVEFaSlRkRldOMnJRK3l2Wml5bjFraHJ1YVVObVltbngvVmk2?= =?utf-8?B?emFGdm0xRVNOL3pVLzF6UXlzaXU2OURoU3JIeXZkbW00cG9DNDY1TURsSGln?= =?utf-8?B?ZXo4STkzOW83bFFyemdMQWpleFhZM2MwZUdDeEJBa2ZGNXAyc2hZdWlLMTVz?= =?utf-8?B?VEdBZnRMUFpocWJjNW43M0lFVHdvVGdMbWlBNmVLNDMxeEFPdlJkTnZDczhx?= =?utf-8?B?QjkrU3NtYXd2aFRvMU1jMloxVEJMdTdwc0lzdGVLRXdtOVdsdy9YcFkwcUlm?= =?utf-8?B?V3JHeis0VFN3PT0=?= X-OriginatorOrg: fortanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7f48acc-92d0-4c3e-1fe5-08da0731ca06 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5626.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2022 09:46:05.5224 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: de7becae-4883-43e8-82c7-7dbdbb988ae6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9W+nB00U3YTZuAxruf8W/b92wgXOZ5pyFIGi7ctqZ2MgHzGwv4EfNbpQXuL7m3zRPncNTmyxJYPCRjHRRWEU7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR11MB5473 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 --------------ms000903000909070506060406 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2022-03-15 02:02, Cathy Zhang wrote: > EUPDATESVN is the SGX instruction which allows enclave attestation > to include information about updated microcode without a reboot. > > Microcode updates which affect SGX require two phases: > > 1. Do the main microcode update > 2. Make the new CPUSVN available for enclave attestation via > EUPDATESVN. > > Before a EUPDATESVN can succeed, all enclave pages (EPC) must be > marked as unused in the SGX metadata (EPCM). This operation destroys > all preexisting SGX enclave data and metadata. This is by design and > mitigates the impact of vulnerabilities that may have compromised > enclaves or the SGX hardware itself prior to the update. > > Signed-off-by: Cathy Zhang > > --- > Changes since v1: > - Remove the sysfs file svnupdate. (Thomas Gleixner, Dave Hansen) > - Let late microcode load path call ENCLS[EUPDATESVN] procedure > directly. (Borislav Petkov) > - Redefine update_cpusvn_intel() to return void instead of int. > --- > arch/x86/include/asm/microcode.h | 5 +++++ > arch/x86/include/asm/sgx.h | 5 +++++ > arch/x86/kernel/cpu/common.c | 9 +++++++++ > arch/x86/kernel/cpu/sgx/main.c | 12 ++++++++++++ > 4 files changed, 31 insertions(+) > > diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h > index d6bfdfb0f0af..1ba66b9fe198 100644 > --- a/arch/x86/include/asm/microcode.h > +++ b/arch/x86/include/asm/microcode.h > @@ -3,6 +3,7 @@ > #define _ASM_X86_MICROCODE_H > > #include > +#include > #include > #include > > @@ -137,4 +138,8 @@ static inline void load_ucode_ap(void) { } > static inline void reload_early_microcode(void) { } > #endif > > +#ifndef update_cpusvn_intel > +static inline void update_cpusvn_intel(void) {} > +#endif > + > #endif /* _ASM_X86_MICROCODE_H */ > diff --git a/arch/x86/include/asm/sgx.h b/arch/x86/include/asm/sgx.h > index d5942d0848ec..d0f2832a57b3 100644 > --- a/arch/x86/include/asm/sgx.h > +++ b/arch/x86/include/asm/sgx.h > @@ -412,4 +412,9 @@ int sgx_virt_einit(void __user *sigstruct, void __user *token, > int sgx_set_attribute(unsigned long *allowed_attributes, > unsigned int attribute_fd); > > +#ifdef CONFIG_X86_SGX > +void update_cpusvn_intel(void); > +#define update_cpusvn_intel update_cpusvn_intel > +#endif > + > #endif /* _ASM_X86_SGX_H */ > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > index 64deb7727d00..514e621f04c3 100644 > --- a/arch/x86/kernel/cpu/common.c > +++ b/arch/x86/kernel/cpu/common.c > @@ -59,6 +59,7 @@ > #include > #include > #include > +#include > > #include "cpu.h" > > @@ -2165,6 +2166,14 @@ void microcode_check(void) > > perf_check_microcode(); > > + /* > + * SGX related microcode update requires EUPDATESVN to update CPUSVN, which > + * will destroy all enclaves to ensure EPC is not in use. If SGX is configured > + * and EUPDATESVN is supported, call the EUPDATESVN procecure. > + */ > + if (IS_ENABLED(CONFIG_X86_SGX) && (cpuid_eax(SGX_CPUID) & SGX_CPUID_EUPDATESVN)) > + update_cpusvn_intel(); > + > /* Reload CPUID max function as it might've changed. */ > info.cpuid_level = cpuid_eax(0); > > diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c > index 123818fa2386..d86745d8cc7d 100644 > --- a/arch/x86/kernel/cpu/sgx/main.c > +++ b/arch/x86/kernel/cpu/sgx/main.c > @@ -1380,3 +1380,15 @@ static int sgx_updatesvn(void) > > return ret; > } > + > +void update_cpusvn_intel(void) > +{ > + sgx_lock_epc(); > + if (sgx_zap_pages()) Doing this automatically and unconditionally during a microcode update seems undesirable. This requires the userland tooling that is coordinating the microcode update to be aware of any SGX enclaves that are running and possibly coordinate sequencing with the processes containing those enclaves. This coupling does not exist today. -- Jethro Beekman | Fortanix > + goto out; > + > + sgx_updatesvn(); > + > +out: > + sgx_unlock_epc(); > +} --------------ms000903000909070506060406 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCC DVUwggXgMIIDyKADAgECAhAorKRKpFwMN77KaahISgU8MA0GCSqGSIb3DQEBCwUAMIGBMQsw CQYDVQQGEwJJVDEQMA4GA1UECAwHQmVyZ2FtbzEZMBcGA1UEBwwQUG9udGUgU2FuIFBpZXRy bzEXMBUGA1UECgwOQWN0YWxpcyBTLnAuQS4xLDAqBgNVBAMMI0FjdGFsaXMgQ2xpZW50IEF1 dGhlbnRpY2F0aW9uIENBIEczMB4XDTIxMDkyMDA4MjgxMloXDTIyMDkyMDA4MjgxMlowHjEc MBoGA1UEAwwTamV0aHJvQGZvcnRhbml4LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC AQoCggEBAN7ILCRnCqfq7ADD69ye2hNX9tiR29nMKgMVdUSx3FOQPEgohsmmuQOPiX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