From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.58]) by mx.groups.io with SMTP id smtpd.web10.22022.1681503786731544140 for ; Fri, 14 Apr 2023 13:23:07 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=EzShit4L; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.95.58, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jCx/Vc4tKhDv2LBi2Pq95lkUsr7rKi0GcELP8oAzDEwZrklDlPy/NgpPP0GXsFYm5+bRvMWt4bghI/ZHFJFY8zOl/IkxwQB+7tyP/ZTsH0qSginFll49RCLb33qxVPSufAo5aDJO4H/8rfigLzt2i9G3WQwwffIlYIZFfz632ByXd+m/hj7/cK7G7nA2/4KsQc0fN+f8sTyjihlTCehUsUp1P/BLTt3RAg4aj5heGKSYIqU8jG5/2/Fddk82A2ZPU+o5cHp5+N30CyVWoveOsF77xTqAPENgvdKbhPng67vSLYSmiCzwuJBneUPa8vJpaYkrmyUNGFKA1rGi6za4ww== 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=2zFTU0C2WvtAShOMy5LV0rzvNtGorn/sXzqio+XMiN4=; b=mAXuE6NzdSmKY3BYcsBPQ91aoalmbOO/bbu5o1dIIrHoXaI3hIm1UZvZ4XdROpWlj38zWjBLnbCEhIpXBcYgWmSgFA0D1Z3jq3FA1OzPAj5tIVBedO5N/5YqMmVCszv+ILoMSJ6W97gYJDANWArQrrVZ5gU62Hn7AsxZ+f3/mdCyc4GbdiHd7OVJcI1dcqevrEz0LP2vIAPePo2UaZ3G38EvRn3entH9z0jPtc1nNqJFrBE4QNYdgJfMxQhpIPZoIjOhSLWghcKZSKnzEr85+mesAZ2lYIu0XBgg4ytLyU16ox27yRnvHTaPK8Q/Ti4x7OeGQe8zCtKMKXBGlWi3+Q== 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=2zFTU0C2WvtAShOMy5LV0rzvNtGorn/sXzqio+XMiN4=; b=EzShit4LuI3tc52ycV2xQRPvfzmO71fFlrSPtEA7qu5wGywzFKjacR3UrhShQ0uaZp1kZYyNKcvBzuIpFN34gLfzSP/lSLCe2DIuhBO6Dzvcopl4YT28T7wZgHm33dEaQvWaaDGyRHm2Af60ubgUZdPeD2JVp2KUaqHG1qhbegg= 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 MW4PR12MB7016.namprd12.prod.outlook.com (2603:10b6:303:218::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Fri, 14 Apr 2023 20:23:04 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::ea32:baf8:cc85:9648]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::ea32:baf8:cc85:9648%6]) with mapi id 15.20.6298.030; Fri, 14 Apr 2023 20:23:03 +0000 Message-ID: <7f0f5f8e-09c7-4ae4-ffca-1a7c322949a8@amd.com> Date: Fri, 14 Apr 2023 15:23:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 To: "devel@edk2.groups.io" Cc: Ard Biesheuvel , Gerd Hoffmann From: "Lendacky, Thomas" Subject: Strange behavior between GCC 11 and GCC 12 X-ClientProxiedBy: SN7PR04CA0195.namprd04.prod.outlook.com (2603:10b6:806:126::20) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) Return-Path: Thomas.Lendacky@amd.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR12MB5229:EE_|MW4PR12MB7016:EE_ X-MS-Office365-Filtering-Correlation-Id: e0e77773-1091-4328-d7fe-08db3d260ce5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gV2q6LOqh8ydjihvXVI1NvbxmHeDkEq8TQiFKa3GzoShNQ3Xw9qBs5xJ6s4aAoQ3oH/1mTHDQJP7WLDGiHODAywfLowYPqZNXVVR8lhTGFVmqhUFVNQAbCgYGJuy+EXTbrVlSkw51h+3vauZSpkmsXnHM8nzf7BZepaXxqE69/udJq7V1VZu2qio7LhthacpyYWlKy6Z3mfY2V6mQpL2KB8Gs+4ebbWO86o6R2NRNsSLfXaXn2y4PKBgLQ1hxrkHCr+TLOE/Hkq3k8UnD1dHDZ6xu1PO6GVeNscX565d7wQVLMX3QBUlmTscYe4WOM6VdG6o9lk0KTB7R0noHO7xOaC3gtxZhXltALfaZcBIKjljudMw7etUlZZ6/32C6cRULu6VSqqgUsp5tIqHg24bWTmt/hmi1IRv0dKFsw8zKkk8kSzafwk4u05ddorrek9wSSx+k3oEAGZUaCzfdVVF8LiRv01XIsPF57Yg8S9huTnc+eP80zc5rRHN+tnNWKt8rPwJSJMUaPeeLnIQvIiBwLXC+mKnTJvEVHaNJr+RTWg3mi2kBdU2mrJqnR912bC3tFcqlyTFZNgKvhlVne/NNCCUPkW0bBpgiIau1fnGqG36OKue0k1+EvUEHC8on1vATpbsJFSR8aG0zYMStHPb/w== 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)(346002)(396003)(376002)(39860400002)(366004)(136003)(451199021)(478600001)(31696002)(54906003)(8936002)(8676002)(86362001)(26005)(19627235002)(6506007)(6512007)(38100700002)(316002)(6486002)(31686004)(186003)(36756003)(6916009)(4326008)(66476007)(66556008)(41300700001)(66946007)(5660300002)(2906002)(2616005)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K0gwRXE4ZlByUnI4U0lOMmRTM2lCMk4vL2dOZGpuaXdvK1dlZzNxYnJHaVFi?= =?utf-8?B?UklnV0p3c3pCR1MzcGVIZkhjYmhWTkR3S3JsWGQ0TjUrOEFXcHFKYklTQlpG?= =?utf-8?B?Z0l3K2hOWFc5TUZlWmlRTHd4WFIrVFJrdXFFem1SVjYraXVad3lUMWhxL3NX?= =?utf-8?B?ZUZCRUYwMlpjZDBIU0ZWSTVmdnppaHZVRGU2STB6S1VKYUpHVkZtYWltMUVS?= =?utf-8?B?TGhWWnpnbndBYkR2NzJVV2krR2hVcmJwenZoZ1Q2UC9PV3ZIb09RNHZnSk02?= =?utf-8?B?OUNFQytwSzJraS9ZUFpBcXJFZXE5NU1CTWNPbk0yZ1lOK256SllXMWxPWXA4?= =?utf-8?B?ZUFaWVpOajhYUnFTVXVpOUl1bjhhUjRLbUpSTnlEMVBYTitzbHlTa1c2OUxi?= =?utf-8?B?dkJEK1BWNGpCM2JmQ0pWRDBqcjl3R1poVTJ1dVZJKzVrNDJLTUpXeFhVdlZV?= =?utf-8?B?SUJabmdyek1XeWhTeGE2WmhNWjJYUE5NUE1kdndPUjNQcFpEY21CRDMzZU5N?=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EMyTVhZUXZlanAra3Ju?= =?utf-8?B?Y1lkU0xIUHpBSno5aDFxR21OWkRkUjl2N1ZBSVlJaFl6RW50Y0JucjhmUEwz?= =?utf-8?B?VUQ1U3REVnpaSnFya0QzV1hXbVRSSUZUaGh4QTh1NFBpU21rSUdOOEZmNEtK?= =?utf-8?B?cmZld1k5NllDazdUTFF0c2I3WWZpa2c5YTJiM1ZaaDIxOUI5OHkyS1BGTUgv?= =?utf-8?B?RTlVZTJHYmJONHZyc0VGUnlJUWRvWVZaaVo3OTVFVzl5bzFNQ2RTTU5uR2dD?= =?utf-8?B?Uktjdjgzalh5N3NnTU9maG9WUnIyeUZSSkpNaHhVbEVmTFhrM1FxMUQyQXBU?= =?utf-8?B?cTlETnlWQ1lURmVxSkhNRFlTZGlScVdKRy9NOUg0VGM4aTBUV3ZZcVF4Z2Vm?= =?utf-8?B?UDBmeHZ4SWd3NHFOUHBkWnV0TVVQQWdObFo1bjltaGV2WVVVVldBbENiZXBa?= =?utf-8?B?aW5odlJWVkxpVHR2WHVVYUNHZ0xTZVFOcDRFWXRvQWZKaWxrWDVTZVk5SGcy?= =?utf-8?B?di9xVHNKblhnNEpPTnBFUWoxQ1FjamZoVXZiMTBHK2hTQW5kcCtTQis4QklR?= =?utf-8?B?ak9yTUg5MXIrQ3JrM3dwdTJQbHlKL0hGRklNZDJsZkZOcmN2eTNFNjhaSC9B?= =?utf-8?B?YzVWMzUySjFFbktSaUdDbmFsMFQ4S2p0TlNjdTVFL2p2bW90QXpGYnJpbVZG?= =?utf-8?Q?Dvy5mvO3m6XR5S/r5rAWPJimA?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0e77773-1091-4328-d7fe-08db3d260ce5 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2023 20:23:03.9085 (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: 7ab1WWR5DsgqpTzGyrDYOdkApeHvfIRUQvVj58ViD0tPiX6nFbqn1Ch2oPG5nVW31c8RDrrtjqOZOgwQesviZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7016 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit I've been trying to debug a problem I'm seeing when I moved to the GCC 12 compiler. Under SEV it results in the guest crashing. I narrowed the issue down to the call to TemporaryRamMigration() in PeiCheckAndSwitchStack() of MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c. I get this output on GCC11: Old Stack size 32768, New stack size 131072 Stack Hob: BaseAddress=0x3BF76000 Length=0x20000 Heap Offset = 0x3B786000 Stack Offset = 0x3B776000 *** DEBUG: PeiCheckAndSwitchStack:851 - SecCoreData=3BF95D20 TemporaryRamMigration(0x810000, 0x3BF8E000, 0x10000) *** DEBUG: PeiCheckAndSwitchStack:871 - SecCoreData=3BF95D20 and everything is good. However, I get this output on GCC12: Old Stack size 32768, New stack size 131072 Stack Hob: BaseAddress=0x3BF76000 Length=0x20000 Heap Offset = 0x3B786000 Stack Offset = 0x3B776000 *** DEBUG: PeiCheckAndSwitchStack:851 - SecCoreData=3BF95D20 TemporaryRamMigration(0x810000, 0x3BF8E000, 0x10000) *** DEBUG: PeiCheckAndSwitchStack:871 - SecCoreData=7770BD20 MMIO using encrypted memory: 7770BD48 !!!! X64 Exception Type - 0D(#GP - General Protection) CPU Apic ID - 00000000 !!!! and terminate because SecCoreData has been corrupted and points to an address in an MMIO range (this is an SEV-ES/SEV-SNP example). As near as I can tell from looking at the object code, on GCC12 it looks like the SecCoreData value is stored in the RBP register, which appears to be getting corrupted when calling TemporaryRamMigration(). Does anyone have any thoughts on this? Thanks, Tom