Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2477971rdb; Mon, 12 Feb 2024 06:19:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWlcpjQAtxur8Q40SSZ+9mvYqjTXAQxnV+eixBKsgOpC30CSMsXFxObaDol7FzPScEje6LVjIz5S1uPwVeyDtaEtQdqw0xE3MY+OdBMzA== X-Google-Smtp-Source: AGHT+IF0BYMV/Z+sZ2UrP5NBQsM/l0fT+tIBniXlnTtGVCQbd+OoqDde1j8KNscDVBv+aVmLfJGa X-Received: by 2002:a05:6214:acc:b0:68c:9dbb:396 with SMTP id g12-20020a0562140acc00b0068c9dbb0396mr9257683qvi.0.1707747543397; Mon, 12 Feb 2024 06:19:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707747543; cv=pass; d=google.com; s=arc-20160816; b=hCy3B0ZoCgDRvFmJU8mXw45+RiBimitCxbeyT0zHdYToCA8wRHPlaLg839DbO4NETQ ZfH2RueNmF8qHpDQNGl1XMHbHaGIn9rYMGD5Pz7cY6bZYT0zsMV8mFp7qYjZZT4GTcQf A2y9kIqpSMngrLjk8s5YZpNjXDn8WY5ymyN9ii2Hn5UwDfaoRTI0x/D+huPqaEYpPGLC EpW97M2iKNBZ0YJmY/DsqYVhmG8IvPdTQtI/CLFxbnVkho4sSEzFzUkyAYdtk5fJx1Xp 4jUWdvgpqOMkHKPnSmtDjyrfF8Rfg2pRXFvCVWUwpVUs5hF4gxQBb66a5nu68odkQg4Z OjEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Mbg10JQUB0lPBCtUWFlsiStYjE1OGMMzSdgwiAyceo8=; fh=FCUTgGoIDfeiJzaDk/Kn8wGVtnxp56mowb8BLcJC9nY=; b=lmLelBNSa2a+T/c637StBnqYKh/TnqcfEdBU6ZPDN9g+r85G+ul8Z9IqhgoiHk2BaU 2dewsa3RmLeXGNktxRoci8NBnF7kUq8U95olUcoKnkQju9MIqAfcA7WPnNdbIS03eOkD 7f0v2MCQTPHUXRHSUGJJSpwma2kSCEGf9owecnBCJEZnM2DdmxQO53uUH+jyVF4wgW+J lMOnQa5AWT9gGSZpUl4Ds67BoYXqU9AsnAMZCZ2Fd/MusvlRsV48VlSyRyE55mKTSNlF Vp+w1R2jRMiGrFk3fEwCVtp0ET+WnGulTMUIpKFNap9V9IuDm28Zt4fixFc8MZoput/U g4XA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=DhAUe4nz; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-61815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61815-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de X-Forwarded-Encrypted: i=2; AJvYcCUylgmrnGm8zrssiHpFP1y2WanmtUBgSM99Cayi2ircldurb26W0BpqeqdQ9r7Jr19T2olYa5iRcre5hX62R7oDXtjDxUTepP3SO1A/ag== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kj15-20020a056214528f00b0068cb644b482si475863qvb.197.2024.02.12.06.19.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:19:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=DhAUe4nz; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-61815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61815-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0BADE1C21497 for ; Mon, 12 Feb 2024 14:19:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8EE73A8E3; Mon, 12 Feb 2024 14:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="DhAUe4nz" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 576D63A28E; Mon, 12 Feb 2024 14:18:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707747525; cv=none; b=PvziyZvakNDAXDNYMyZ/3tw8ubu+DUP9ZHMaFGdGXYSkhJTsIXXEapxTr6SEuaHHbe2G6mvKJDPqC1VPd2/18DHF7KCKpe11eVvngcHMDDNXiE7tDQNJm4u/mU5B5P6U6rvXLdhUUk3zB7JmugxPqFgRt8wqH/X2W+ii8q6Velo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707747525; c=relaxed/simple; bh=diPelT6Y5PrLF1JoSluZSPxFcNd3XxVYAnkF1E99aTc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XMrqqj1C3CuB/RPqoOlA57mscb0lfFO7zB6wJz+4zuH/gQhxAL4kY9ITVcTDCe8W6BcaqkVlpzxKM+CdDT1v5ozu1pzdwkc1xkm7Wyut4U3AzHRM2H34SaZpPWnrALVqps8PWYyK4DI5ED0Em8uucbE3UpvgB3zYsP/i3nCQPx4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=DhAUe4nz; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 7747340E01BB; Mon, 12 Feb 2024 14:18:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nUZNN3hS0edi; Mon, 12 Feb 2024 14:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1707747518; bh=Mbg10JQUB0lPBCtUWFlsiStYjE1OGMMzSdgwiAyceo8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DhAUe4nzS0Hdh0Z391hKMbHgSf4e6xOHu++V8YdbKN5S+TlLEVNgEye38Kbi3UZ1q y7LAamRaJ8Ve5Qdq1157SPrmjCz4mQ4mZbLvxDxXwAwh6lo06GZLr88r0Xyy7OcJVP X027AmgWooiL95mCdCrhMNULBRh3RqOAIIFN59ZrVauKutOrnYThdc23FKkukNfSFR UzWWx5gvOCDc+nOG0HpCklblR7wUpSVV/uvbEqPRkq53yPUCYK4++Er1fWa8Tup/dv 2d6snO2wIPPOGBhSYJ0yNEoVQDIUU8vn3DzFbR4P/+jwQB03RUhmgOo16eIpicCYiN yf/L899rtLp6dbJgm2zxgDXN+XW2rRKp6rAMINoCiqJvEvRZWqGXGfVxzVX6WE6nrq 1orKZ1Zk0BjOBcnNUkqSFaIsgSe3a5nKHaSlqtoWt5DFWLuZNGHraAsyLeAclFmW0f XFRCER6PhOMV4PnGYtNn0Um/0wnHzJ7/BIt25ODF/1szqbp5mwlG85wHuJwMdi6Yel UPAb4rSeTd1BDSK4Op98DNp8+HZn/9Si1o4AVNyfLzpiYd0S60HEFK1MMyn2nTdXkX 987LeLXCMwx9fjDOPfVSELrbmxjd/qu1v3cpor3IMY4VBL21CZVaYQPybJk4mxRXDt Uc8rbmrcCsvsufPteW2JvfWM= Received: from zn.tnic (pd953021b.dip0.t-ipconnect.de [217.83.2.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id CA46C40E0196; Mon, 12 Feb 2024 14:18:19 +0000 (UTC) Date: Mon, 12 Feb 2024 15:18:15 +0100 From: Borislav Petkov To: Ard Biesheuvel Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Kevin Loughlin , Tom Lendacky , Dionna Glaze , Thomas Gleixner , Ingo Molnar , Dave Hansen , Andy Lutomirski , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Justin Stitt , Kees Cook , Brian Gerst , linux-arch@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v3 08/19] x86/head64: Replace pointer fixups with PIE codegen Message-ID: <20240212141815.GDZcoop-AL-a6kiHcY@fat_crate.local> References: <20240129180502.4069817-21-ardb+git@google.com> <20240129180502.4069817-29-ardb+git@google.com> <20240212102901.GVZcny7WeK_ZWt0HEP@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Mon, Feb 12, 2024 at 12:52:01PM +0100, Ard Biesheuvel wrote: > Yeah. That would means adding PIE_CFLAGS_REMOVE alongside PIE_CFLAGS > and applying both in every place it is used, but we are only dealing > with a handful of object files here. Right. And we already have such a thing with PURGATORY_CFLAGS_REMOVE. > Thanks. But now that we have RIP_REL_REF(), I might split the cleanup > from the actual switch to -fpie, which I am still a bit on the fence > about, given different compiler versions, LTO, etc. Tell me about it. Considering how much jumping through hoops we had to do in recent years to accomodate building the source with the different compilers, I'm all for being very conservative here. > RIP_REL_REF(foo) just turns into 'foo' when compiling with -fpie and > we could drop those piecemeal once we are confident that -fpie does > not cause any regressions. Ack. > Note that I have some reservations now about .pi.text as well: it is a > bit intrusive, and on x86, we might just as well move everything that > executes from the 1:1 mapping into .head.text, and teach objtool that > those sections should not contain any ELF relocations involving > absolute addresses. But this is another thing that I want to spend a > bit more time on before I respin it, so I will just do the cleanup in > the next revision, and add the rigid correctness checks the next > cycle. I am fully onboard with being conservative and doing things in small steps considering how many bugs tend to fall out when the stuff hits upstream. So going slowly and making sure our sanity is intact is a very good idea! Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette