Commit 0672a694 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Ard Biesheuvel
Browse files

FROMLIST: crypto: shash - stop comparing function pointers to avoid breaking CFI



crypto_shash_alg_has_setkey() is implemented by testing whether the
.setkey() member of a struct shash_alg points to the default version
called shash_no_setkey(). As crypto_shash_alg_has_setkey() is a static
inline, this requires shash_no_setkey() to be exported to modules.

Unfortunately, when building with CFI, function pointers are routed
via CFI stubs which are private to each module (or to the kernel proper)
and so this function pointer comparison may fail spuriously.

Let's fix this by turning crypto_shash_alg_has_setkey() into an out of
line function, which makes the problem go away.

Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Bug: 153614920
Bug: 188620248
Link: https://lore.kernel.org/linux-crypto/20210610062150.212779-1-ardb@kernel.org


Change-Id: Ib94d812e2668020144bf8246ddbbc8b652cdf2b7
Signed-off-by: default avatarArd Biesheuvel <ardb@google.com>
parent 254da9ba
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment