All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: linux-crypto@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Eric Biggers <ebiggers@kernel.org>,
	Kees Cook <keescook@chromium.org>
Subject: [PATCH v2 00/13] crypto: x86 - avoid absolute references
Date: Wed, 12 Apr 2023 13:00:22 +0200	[thread overview]
Message-ID: <20230412110035.361447-1-ardb@kernel.org> (raw)

This is preparatory work for allowing the x86 kernel to be built as a
PIE executable, which relies mostly on RIP-relative symbol references
from code, as these 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.

Changes since v1:
- add missing tags from Thomas Garnier
- simplify AES-NI GCM tail handling and drop an entire permute vector
  table (patch #2)
- add a couple of patches to switch to local labels, which removes ~1000
  useless code symbols (e.g., _loop0, _loop1, _done etc etc) from
  kallsyms

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Eric Biggers <ebiggers@kernel.org>
Cc: Kees Cook <keescook@chromium.org>

Ard Biesheuvel (13):
  crypto: x86/aegis128 - Use RIP-relative addressing
  crypto: x86/aesni - Use RIP-relative addressing
  crypto: x86/aria - Use RIP-relative addressing
  crypto: x86/camellia - Use RIP-relative addressing
  crypto: x86/cast5 - Use RIP-relative addressing
  crypto: x86/cast6 - Use RIP-relative addressing
  crypto: x86/crc32c - Use RIP-relative addressing
  crypto: x86/des3 - Use RIP-relative addressing
  crypto: x86/ghash - Use RIP-relative addressing
  crypto: x86/sha256 - Use RIP-relative addressing
  crypto: x86/aesni - Use local .L symbols for code
  crypto: x86/crc32 - Use local .L symbols for code
  crypto: x86/sha - Use local .L symbols for code

 arch/x86/crypto/aegis128-aesni-asm.S         |   6 +-
 arch/x86/crypto/aesni-intel_asm.S            | 198 +++++++--------
 arch/x86/crypto/aesni-intel_avx-x86_64.S     | 254 +++++++++-----------
 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     |   6 +-
 arch/x86/crypto/cast5-avx-x86_64-asm_64.S    |  38 +--
 arch/x86/crypto/cast6-avx-x86_64-asm_64.S    |  32 +--
 arch/x86/crypto/crc32-pclmul_asm.S           |  16 +-
 arch/x86/crypto/crc32c-pcl-intel-asm_64.S    |  70 +++---
 arch/x86/crypto/des3_ede-asm_64.S            |  96 +++++---
 arch/x86/crypto/ghash-clmulni-intel_asm.S    |   4 +-
 arch/x86/crypto/sha1_avx2_x86_64_asm.S       |  25 +-
 arch/x86/crypto/sha256-avx-asm.S             |  16 +-
 arch/x86/crypto/sha256-avx2-asm.S            |  54 +++--
 arch/x86/crypto/sha256-ssse3-asm.S           |  16 +-
 arch/x86/crypto/sha512-avx-asm.S             |   8 +-
 arch/x86/crypto/sha512-avx2-asm.S            |  16 +-
 arch/x86/crypto/sha512-ssse3-asm.S           |   8 +-
 22 files changed, 509 insertions(+), 494 deletions(-)

-- 
2.39.2


             reply	other threads:[~2023-04-12 11:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 11:00 Ard Biesheuvel [this message]
2023-04-12 11:00 ` [PATCH v2 01/13] crypto: x86/aegis128 - Use RIP-relative addressing Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 02/13] crypto: x86/aesni " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 03/13] crypto: x86/aria " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 04/13] crypto: x86/camellia " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 05/13] crypto: x86/cast5 " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 06/13] crypto: x86/cast6 " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 07/13] crypto: x86/crc32c " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 08/13] crypto: x86/des3 " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 09/13] crypto: x86/ghash " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 10/13] crypto: x86/sha256 " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 11/13] crypto: x86/aesni - Use local .L symbols for code Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 12/13] crypto: x86/crc32 " Ard Biesheuvel
2023-04-12 11:00 ` [PATCH v2 13/13] crypto: x86/sha " Ard Biesheuvel
2023-04-12 18:38 ` [PATCH v2 00/13] crypto: x86 - avoid absolute references Kees Cook
2023-04-20 10:21 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230412110035.361447-1-ardb@kernel.org \
    --to=ardb@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=keescook@chromium.org \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.