From 59dec116361fe9afb50fb93f1679e7359ab67a49 Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Wed, 15 May 2019 15:07:52 -0700 Subject: [PATCH] ANDROID: crypto: arm64/ghash: fix CFI for GHASH CE Calling a stand-alone assembly function trips clang's Control-Flow Integrity checking. Add a static inline stub to convert indirect calls to direct calls for pmull_ghash_update_p(64|8). Bug: 133186739 Change-Id: Ib4899cdae60d83961f78ed3451a919f7c9c713bc Signed-off-by: Sami Tolvanen --- arch/arm64/crypto/ghash-ce-glue.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c index 067d8937d5af..b2003e2077e0 100644 --- a/arch/arm64/crypto/ghash-ce-glue.c +++ b/arch/arm64/crypto/ghash-ce-glue.c @@ -60,6 +60,22 @@ asmlinkage void pmull_ghash_update_p8(int blocks, u64 dg[], const char *src, struct ghash_key const *k, const char *head); +#ifdef CONFIG_CFI_CLANG +static inline void __cfi_pmull_ghash_update_p64(int blocks, u64 dg[], + const char *src, struct ghash_key const *k, const char *head) +{ + return pmull_ghash_update_p64(blocks, dg, src, k, head); +} +#define pmull_ghash_update_p64 __cfi_pmull_ghash_update_p64 + +static inline void __cfi_pmull_ghash_update_p8(int blocks, u64 dg[], + const char *src, struct ghash_key const *k, const char *head) +{ + return pmull_ghash_update_p8(blocks, dg, src, k, head); +} +#define pmull_ghash_update_p8 __cfi_pmull_ghash_update_p8 +#endif + static void (*pmull_ghash_update)(int blocks, u64 dg[], const char *src, struct ghash_key const *k, const char *head);