diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2022-01-19 12:31:09 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2022-01-31 03:21:44 +0300 |
commit | 1c16dfbe6cd6b6ce04e2c3d0c1fa33d80b2547f9 (patch) | |
tree | 59dbc0b6e7024d12191aca3d7144406ebba50a9b /drivers/crypto/marvell | |
parent | 66eae850333d639fc278d6f915c6fc01499ea893 (diff) | |
download | linux-1c16dfbe6cd6b6ce04e2c3d0c1fa33d80b2547f9.tar.xz |
crypto: memneq - avoid implicit unaligned accesses
The C standard does not support dereferencing pointers that are not
aligned with respect to the pointed-to type, and doing so is technically
undefined behavior, even if the underlying hardware supports it.
This means that conditionally dereferencing such pointers based on
whether CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y is not the right thing
to do, and actually results in alignment faults on ARM, which are fixed
up on a slow path. Instead, we should use the unaligned accessors in
such cases: on architectures that don't care about alignment, they will
result in identical codegen whereas, e.g., codegen on ARM will avoid
doubleword loads and stores but use ordinary ones, which are able to
tolerate misalignment.
Link: https://lore.kernel.org/linux-crypto/CAHk-=wiKkdYLY0bv+nXrcJz3NH9mAqPAafX7PpW5EwVtxsEu7Q@mail.gmail.com/
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/marvell')
0 files changed, 0 insertions, 0 deletions