From db96212bdede8915d9769eddcd378f70a8e4d279 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 20 Oct 2020 16:49:28 +0200 Subject: [PATCH] ANDROID: GKI: fix ABI breakage in module.h commit 262e6ae7081d ("modules: inherit TAINT_PROPRIETARY_MODULE") changes the size of 'struct module' a bit by adding a single boolean value to the middle. Move things around a bit and take up a space to preserve the abi so that nothing changes with the abi before that commit was merged. This might be able to be dropped at the next Android KABI "Break", if one happens. Bug: 171277690 Fixes: 262e6ae7081d ("modules: inherit TAINT_PROPRIETARY_MODULE") Signed-off-by: Greg Kroah-Hartman Change-Id: Ie31a6fcea384ad665248c87f7abfde4d214da70a --- include/linux/module.h | 8 ++++++-- kernel/module.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 4f71785d6bbd..5246cbce5881 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -346,6 +346,11 @@ struct klp_modinfo { }; #endif +struct module_kabi_preserve_1 { + u64 using_gplonly_symbols:1; + u64 free:63; +}; + struct module { enum module_state state; @@ -382,7 +387,6 @@ struct module { unsigned int num_gpl_syms; const struct kernel_symbol *gpl_syms; const s32 *gpl_crcs; - bool using_gplonly_symbols; #ifdef CONFIG_UNUSED_SYMBOLS /* unused exported symbols. */ @@ -516,7 +520,7 @@ struct module { struct error_injection_entry *ei_funcs; unsigned int num_ei_funcs; #endif - ANDROID_KABI_RESERVE(1); + ANDROID_KABI_USE(1, struct module_kabi_preserve_1 m1); ANDROID_KABI_RESERVE(2); ANDROID_KABI_RESERVE(3); ANDROID_KABI_RESERVE(4); diff --git a/kernel/module.c b/kernel/module.c index aca3a6355165..60f6a995265c 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1432,7 +1432,7 @@ static bool inherit_taint(struct module *mod, struct module *owner) if (!owner || !test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints)) return true; - if (mod->using_gplonly_symbols) { + if (mod->m1.using_gplonly_symbols) { pr_err("%s: module using GPL-only symbols uses symbols from proprietary module %s.\n", mod->name, owner->name); return false; @@ -1471,7 +1471,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod, goto unlock; if (license == GPL_ONLY) - mod->using_gplonly_symbols = true; + mod->m1.using_gplonly_symbols = true; if (!inherit_taint(mod, owner)) { sym = NULL;