Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2157978rwl; Sat, 8 Apr 2023 08:52:18 -0700 (PDT) X-Google-Smtp-Source: AKy350bed8ZEWWWMgT8RpUMMw8sbpvCyrpyVx+4s5gmKKu4+JOZ0mUq0UC/zD80a/l8+E99ad9GT X-Received: by 2002:a05:6402:524e:b0:502:92d:4f50 with SMTP id t14-20020a056402524e00b00502092d4f50mr2486278edd.1.1680969137812; Sat, 08 Apr 2023 08:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680969137; cv=none; d=google.com; s=arc-20160816; b=wWKxSHn3u6OxbpQCtNoR8MNSN6PHYGkHWBdjHk6cGIK1rZtm7WaXaVETSnDwdNU578 GLYmXiZWCBZH6gDWH+HdgFE5/SSe7dtOS2IUyhGPzWIRODkBHbpNegCutl/FkSKIz1QQ 2j31Cq1b4SSsFi9/2/5tEpQS/q4NF83tHuy34KR0IBDV6enOx0yEYgP4Ko+4SwnjHB8A n451p9mfICSBMjBpI7dd78naz8iZAVTPOtFVcQgCx40AP5hBY32PM0lOsnSg9B69vbPa pXSiDg0q54ljg5hRyV4HPdH6S7cZtIerdadEjndK4q8P6+UzigA83hL9bzc687RoJlDD dhfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cEuYY6Pbmjh6wrdCKFPrcIzNOUoQcqTzJbNwJ+01yLw=; b=i3RLK9aoMuyyt3xo18ZK4ZDVqaJeqSnNOtOvfCXfrEq3l295tWfpeTU0rYP2eP1uCs KDd5o02bGL0YK3cIlL1lYIF5U9BrTcmSOuQaprXxCH3LbWnr1TD2adGNUcAoyvsXIyvU 4JdIX+TGRHIK70I0UZ2hYu6yMDrDjEZ3pUGwyME0pRwOb5i/ifYnhPfxyMrgADX/EBzf vDPw2Pn6yto/ICDFmsxh1WFy+YK7InHnwo/0nB34UFeYMZuy5BQ7iK6zWS2h/78TWvCX e4JCscc2jU9TGW7JHMwUglxoCt16gnq6HGc4oETCaG46aw85Gu3v/v9w/Gkn421ltR7n Azfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ERycMkEg; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c7-20020aa7c987000000b005049298481csi694614edt.406.2023.04.08.08.51.49; Sat, 08 Apr 2023 08:52:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=@kernel.org header.s=k20201202 header.b=ERycMkEg; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbjDHPdA (ORCPT + 99 others); Sat, 8 Apr 2023 11:33:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbjDHPdA (ORCPT ); Sat, 8 Apr 2023 11:33:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE4733AB0 for ; Sat, 8 Apr 2023 08:32:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8B95860D3A for ; Sat, 8 Apr 2023 15:32:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E81FBC4339E for ; Sat, 8 Apr 2023 15:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680967977; bh=NZoj/OY0+5Ty7CnWda5nWmmNZC+uA/YodJGXvWhs+7U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ERycMkEgEmfkwdJsjvSGnG49syNOkjcZMy7ana5+YQCJPgMe4cCRryczl+rC/bELh mBWHigAXonzzxpJyQQULe+MZ8yX4Qip2MDe9eaMwdpZA+VdjgD0I465GtfzGdUGyhy +x841qEwlmr3dOV8in3x231ohnxptkV5WE3kujfaQW6XssmYhhFO2dZgnRko5dQGyW sKBrem/jbZdQCYNcNmp0v6Z7fnthLPSJb6EUO29XZwKHJdc7GNB8tbv7kmPNPVLq1e EBJuHvT4O6MZWOBvNIjj1sgllJ70r412p4PSSjXCJOpEzoPjOjQFXa3YQNCDC3gOZI d/nWYTWuivTAw== Received: by mail-lj1-f174.google.com with SMTP id bd22so3815897ljb.5 for ; Sat, 08 Apr 2023 08:32:57 -0700 (PDT) X-Gm-Message-State: AAQBX9fYr3HcCzmgezhkRhTB286IMI4uy3j+JnKVWIcOkJ8Iij9kpwS/ /XEOd3qW3apP6v92iRuJmoTeKcYAvIewaEYY1fQ= X-Received: by 2002:a2e:959a:0:b0:2a7:5fe2:1c90 with SMTP id w26-20020a2e959a000000b002a75fe21c90mr1046152ljh.2.1680967975896; Sat, 08 Apr 2023 08:32:55 -0700 (PDT) MIME-Version: 1.0 References: <20230408152722.3975985-1-ardb@kernel.org> In-Reply-To: <20230408152722.3975985-1-ardb@kernel.org> From: Ard Biesheuvel Date: Sat, 8 Apr 2023 17:32:44 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 00/10] crypto: x86 - avoid absolute references To: linux-crypto@vger.kernel.org Cc: Herbert Xu , Eric Biggers , Kees Cook Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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-crypto@vger.kernel.org On Sat, 8 Apr 2023 at 17:27, Ard Biesheuvel wrote: > > This is preparatory work for allowing the kernel to be built as a PIE > executable, which relies mostly on RIP-relative symbol references from > code, which don't need to be updated when a binary is loaded at an > address different from its link time address. > > Most changes are quite straight-forward, i.e., just adding a (%rip) > suffix is enough in many cases. However, some are slightly trickier, and > need some minor reshuffling of the asm code to get rid of the absolute > references in the code. > > Tested with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y on a x86 CPU that > implements AVX, AVX2 and AVX512. > > Cc: Herbert Xu > Cc: Eric Biggers > Cc: Kees Cook > > Ard Biesheuvel (10): > crypto: x86/camellia - Use RIP-relative addressing > crypto: x86/cast5 - Use RIP-relative addressing > crypto: x86/cast6 - Use RIP-relative addressing > crypto: x86/des3 - Use RIP-relative addressing Note: the patches above are Co-developed-by: Thomas Garnier Signed-off-by: Thomas Garnier but this got lost inadvertently - apologies. Herbert: will patchwork pick those up if I put them in a reply to each of those individual patches? Thanks, > crypto: x86/aegis128 - Use RIP-relative addressing > crypto: x86/aesni - Use RIP-relative addressing > crypto: x86/aria - Use RIP-relative addressing > crypto: x86/crc32c - Use RIP-relative addressing > crypto: x86/ghash - Use RIP-relative addressing > crypto: x86/sha256 - Use RIP-relative addressing > > arch/x86/crypto/aegis128-aesni-asm.S | 6 +- > arch/x86/crypto/aesni-intel_asm.S | 2 +- > arch/x86/crypto/aesni-intel_avx-x86_64.S | 6 +- > arch/x86/crypto/aria-aesni-avx-asm_64.S | 28 +++--- > arch/x86/crypto/aria-aesni-avx2-asm_64.S | 28 +++--- > arch/x86/crypto/aria-gfni-avx512-asm_64.S | 24 ++--- > arch/x86/crypto/camellia-aesni-avx-asm_64.S | 30 +++--- > arch/x86/crypto/camellia-aesni-avx2-asm_64.S | 30 +++--- > arch/x86/crypto/camellia-x86_64-asm_64.S | 8 +- > arch/x86/crypto/cast5-avx-x86_64-asm_64.S | 50 +++++----- > arch/x86/crypto/cast6-avx-x86_64-asm_64.S | 44 +++++---- > arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 3 +- > arch/x86/crypto/des3_ede-asm_64.S | 96 +++++++++++++------- > arch/x86/crypto/ghash-clmulni-intel_asm.S | 4 +- > arch/x86/crypto/sha256-avx2-asm.S | 18 ++-- > 15 files changed, 213 insertions(+), 164 deletions(-) > > -- > 2.39.2 >