Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1338309rdb; Sat, 3 Feb 2024 02:16:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEbtaf3evszMt0+b9jfhOQzjivqEPKfZGP226tOTdWSjfg3ThHqTu0WujevQ82EpuFBTC3 X-Received: by 2002:a17:902:784a:b0:1d7:67ed:f359 with SMTP id e10-20020a170902784a00b001d767edf359mr8191314pln.4.1706955376775; Sat, 03 Feb 2024 02:16:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706955376; cv=pass; d=google.com; s=arc-20160816; b=O6ABZjSrn6N5zNmUsXhMfGmXCTcFJYb2mVQHc+TCNidc+NJIEf7NvY7bztTd8YfMwC Umpb+gCAaLW00NYnMCPAuF5HVYC095ledTaH0Uix2pOjo5/W7gkAwBLnAMF2oZN3xh9t /GVeCBf4GGgBDOoU3mx+3DLMXgLC7VYyBf0pRcNkh/fkThmJno7soHAmCwYCnllwph8B jyVvL/6AMsJmHuvbH3AWSIKinpKaEVHVjZK2elwtE4xUM/c5a6upr/YK93ROIViufXLS Zq3sV2O/7vc78lCGVkaqhBpWVzJ5UJSLeGFZEn8y0vwbAxKUJUJ9exOo5meideW6WdQB 7xoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=qxxuz2J2p7Chf6uH2yTVM5xEF3vgNMCUL6jdWNWRg38=; fh=/95o+Xt2tNH42qb/G0HzN9sayccKB+/lHfzEa/KI68E=; b=FFUrMfsf6l3mQl8MlGDlB0S4stHTzaHVo7EAW/bb2Wz6eALkMcFbCNUkAe+dMy3DQM jp8kkDW85pT+uun0MWv+Dwj/SglTFvUaVMDpjLkS9Bqy21K0YLW3SL4AZRLrH280O0fU +1nc4PFikvru+2llS79ZPNy6N7bn4qC2fo5dNYWtVb/7fP2SQmFdQsvHkDxjDb7jXDWC ZxCSQSe6HGwp1NHFJ04/uEDp4SoT9HBiQFUE4wQX+zXLwRqWqq1bCUJaDRNerKTUbfeg qojnPzds564S6YSN7mA4SDcWhMeRrPyb7WWySB5saj4GzqzTLEMNOyk6aW4rEiGP5YbG smHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ifKg6t7h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51022-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXtV1vCBVHuNOH8bIQ+3OyawauWATbzfQZNmhCZEYsCsIudGtFlFE2/j7CT+8M6Q+ey7OSHvrILQBbHtsyRtDxwhKRoWtzKnxsVm0c1Cw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p8-20020a170902e74800b001d8d12babfasi982084plf.155.2024.02.03.02.16.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 02:16:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51022-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ifKg6t7h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51022-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6AF0E2884FA for ; Sat, 3 Feb 2024 10:16:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DE605D746; Sat, 3 Feb 2024 10:16:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ifKg6t7h" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1B4B5D72E for ; Sat, 3 Feb 2024 10:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706955371; cv=none; b=J41ME8f9GTMpV56D5TGBhCBJxwxtwMobMYRJAbqfKcNGckGkH5YlHc7Gk4ctNBOffxiXzimleu8LLJ8tGOWwLlCNo0rAOC+xYBtBqhFVByllOE5iAPf8F2CQCr04+WjhRRn60qiX29DEjwlR0gEE+wxOQ3uVhrZcp9O1mJUDGEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706955371; c=relaxed/simple; bh=qxxuz2J2p7Chf6uH2yTVM5xEF3vgNMCUL6jdWNWRg38=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ia7b88GkS/VgN2NOXyrfPtaQU5NI1G2xwcAbG9Zo9p/lARuzl4e0ypKnM5gAdH9tlYsdquVIlA8hSqQUB0Km0IL083l8SsTWKlbvxMwCq+bw164nH2CR8iZbFMnUYFEWaycilxizmj7/6Z2cVKHuZLnxjj2a991NVQs4vdRwIOE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ifKg6t7h; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FB9BC43390 for ; Sat, 3 Feb 2024 10:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706955371; bh=qxxuz2J2p7Chf6uH2yTVM5xEF3vgNMCUL6jdWNWRg38=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ifKg6t7h7ZaFdzlONK894NjGz0J83Cpt8IaNzcSrZ9Orl3sBfLnF22QfrcDln8r+y CGN++nrT1sca5Ea9KQR6uZBk3LmFXy/ADIJ4TG4xSR9yW3wxnQJbiLbBqiWYaIn0ca br5GVGPJlPqPbg2xVPhSujifEiMoaVZBmQoxa+5S2Smeti0JHoUrSqKXKdU8kOIEfB g1YdcryTowvT0DZ2oOss+1Lx9oAqOCg3ZJ0TgmvcomX8uNZE47wDAtKYPXURg00GX8 yxI8+O3MzCghJGpoXj1HbSEWlfdhXGrmeeMcka2gA2yXtLZnyTbLkT1KczTtLm0XIb x7a0coKN/enOw== Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2cf591d22dfso32117351fa.0 for ; Sat, 03 Feb 2024 02:16:11 -0800 (PST) X-Gm-Message-State: AOJu0Yzpg1eVwGfOWaqwqUwlVImnSXCNvdWfS8akp6njKontdACujcjP BQMaeXsj8qfIhl2W4QHV+hCSBtRnyL7Aj8EJ9kd/MpF4pOWuHQubUQsQ/fLFjEYbcbxq2oVfzxk jJjzVLW1B7kbR+mxGwzcGmuDsYog= X-Received: by 2002:ac2:410c:0:b0:511:44c9:511d with SMTP id b12-20020ac2410c000000b0051144c9511dmr848164lfi.21.1706955369587; Sat, 03 Feb 2024 02:16:09 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240121182040.GBZa1geI5NxWSslvt0@fat_crate.local> <20240130220845.1978329-1-kevinloughlin@google.com> <20240131140037.GDZbpShX2b0elXlqDA@fat_crate.local> <20240131182944.GJZbqRmBN_KDgK_nmB@fat_crate.local> In-Reply-To: From: Ard Biesheuvel Date: Sat, 3 Feb 2024 11:15:58 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 0/2] x86: enforce and cleanup RIP-relative accesses in early boot code To: Kevin Loughlin Cc: Borislav Petkov , Jacob Xu , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, Nick Desaulniers , Justin Stitt , Tom Lendacky , Pankaj Gupta , Hou Wenlong , Dionna Glaze , Brijesh Singh , Michael Roth , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-coco@lists.linux.dev, Ashish Kalra , Andi Kleen , Adam Dunlap , Peter Gonda , Sidharth Telang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 3 Feb 2024 at 01:22, Kevin Loughlin wrot= e: > > On Wed, Jan 31, 2024 at 10:30=E2=80=AFAM Borislav Petkov w= rote: > > > > On Wed, Jan 31, 2024 at 10:16:55AM -0800, Jacob Xu wrote: > > > We're interested in fixing SEV-SNP guest boots which are currently > > > broken when using a guest kernel compiled with clang. It seems like > > > every other user of SEV/SNP linux kernel code uses GCC to compile the > > > kernel so they've avoided this issue. > > > > Lemme give that a try here. > > > > > E.g. Google COS uses clang to compile the kernel and we've made do > > > with an internal fix for a while. > > > > Which means that, theoretically, you could forward-port this internal > > fix until the issue is fixed for real, I'd say. > > True. I just think it would be better to have an upstream fix for > clang builds of SEV-SNP guests; I believe the first such SEV-SNP code > was merged in 5.19 if I'm not mistaken. The problem is not only Clang. The problem is that we try to keep the stable trees working with newer compilers in general, and we are relying heavily on behavior on the part of the compiler that could change in the future. Those references that GCC happens to emit as RIP-relative today even without the workarounds could easily turn into absolute references on tomorrow's version, given that both are permitted by the code model under -fno-pic. I've compared notes with Kevin internally, and we'll get a minimal, simplified version of these changes into my v4 SEV PIC series so that we can easily cherry-pick the fixes, either into linux-stable or into our downstream fork.