From 63af84cffec198df9c765895b6e8305f39ede730 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 24 Aug 2023 16:58:19 +0000 Subject: [PATCH] ANDROID: fips140: fix the error injection module parameters Commit 63f46b45dda2 ("ANDROID: fips140: eliminate crypto-fips.a build step") made all fips140 source files other than fips140-module.c be compiled in the "fake built-in code" mode. This broke the fail_selftest and fail_integrity_check module parameters, as they are defined in fips140-eval-testing.c. Fix this by making fips140-eval-testing.c be compiled "normally", overriding fips140-defs.h. Bug: 188620248 Fixes: 63f46b45dda2 ("ANDROID: fips140: eliminate crypto-fips.a build step") Change-Id: Iebb70bdcbb698b92a7791fa7307e2325b1a9e4b6 Signed-off-by: Eric Biggers --- crypto/fips140-defs.h | 6 +++--- crypto/fips140-eval-testing.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/crypto/fips140-defs.h b/crypto/fips140-defs.h index 9005f9513308..d3f62e3c3f37 100644 --- a/crypto/fips140-defs.h +++ b/crypto/fips140-defs.h @@ -17,9 +17,9 @@ * related macros to be expanded as they would be for built-in code; e.g., * module_init() adds the function to the .initcalls section of the binary. * - * The .c file that contains the real module_init() for fips140.ko is then - * responsible for redefining MODULE, and the real module_init() is responsible - * for executing all the initcalls that were collected into .initcalls. + * The .c files that contain the real module_init, module license, and module + * parameters for fips140.ko are then responsible for redefining MODULE. The + * real module_init executes all initcalls that were collected into .initcalls. */ #undef MODULE diff --git a/crypto/fips140-eval-testing.c b/crypto/fips140-eval-testing.c index ea3cd653983a..fdc786884d11 100644 --- a/crypto/fips140-eval-testing.c +++ b/crypto/fips140-eval-testing.c @@ -20,6 +20,14 @@ __inline_maybe_unused notrace #undef BUILD_FIPS140_KO +/* + * Since this .c file contains real module parameters for fips140.ko, it needs + * to be compiled normally, so undo the hacks that were done in fips140-defs.h. + */ +#define MODULE +#undef KBUILD_MODFILE +#undef __DISABLE_EXPORTS + #include #include #include