ANDROID: modpost: generate __kexporttab section for vmlinux

Modpost generates the __kexporttab section when
CONFIG_MODULE_SIG_PROTECT_LIST is set.

Bug: 519119852
Change-Id: I341517d2efcc1edcd628c8ead78a9a644318f608
Signed-off-by: Siddharth Nayyar <sidnayyar@google.com>
This commit is contained in:
Siddharth Nayyar authored and Sid Nayyar committed 2026-06-04 01:46:10 -07:00
1 parent 2493fa846d
commit 5c33f63cf5
2 files changed
+34 -1

No files matched your search

+7
View File
@@ -173,6 +173,13 @@ modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS))
endif # ($(KBUILD_EXTMOD),)
ifdef CONFIG_MODULE_SIG_PROTECT
mod-protect-list := $(CONFIG_MODULE_SIG_PROTECT_LIST)
mod-protect-list := $(if $(filter-out /%, $(mod-protect-list)),$(if $(wildcard $(mod-protect-list)),,$(srctree)/))$(mod-protect-list)
modpost-args += $(addprefix -p , $(mod-protect-list))
modpost-deps += $(mod-protect-list)
endif
quiet_cmd_modpost = MODPOST $@
cmd_modpost = \
$(if $(missing-input), \
+27 -1
View File
@@ -2285,6 +2285,25 @@ struct dump_list {
const char *file;
};
static void handle_protected_modules_list(const char *fname)
{
char *buf, *p, *name;
struct module *mod;
buf = read_text_file(fname);
p = buf;
while ((name = strsep(&p, "\n"))) {
list_for_each_entry(mod, &modules, list) {
if (strcmp(mod->name, name) == 0) {
mod->protect_exports = true;
break;
}
}
}
free(buf);
}
static void check_host_endian(void)
{
static const union {
@@ -2309,12 +2328,13 @@ int main(int argc, char **argv)
struct module *mod;
char *missing_namespace_deps = NULL;
char *unused_exports_white_list = NULL;
char *protected_modules_list = NULL;
char *dump_write = NULL, *files_source = NULL;
int opt;
LIST_HEAD(dump_lists);
struct dump_list *dl, *dl2;
while ((opt = getopt(argc, argv, "ei:MmnT:to:au:WwENd:xbv:")) != -1) {
while ((opt = getopt(argc, argv, "ei:MmnT:to:au:WwENd:xbv:p:")) != -1) {
switch (opt) {
case 'e':
external_module = true;
@@ -2373,6 +2393,9 @@ int main(int argc, char **argv)
case 'v':
strncpy(module_scmversion, optarg, sizeof(module_scmversion) - 1);
break;
case 'p':
protected_modules_list = optarg;
break;
default:
exit(1);
}
@@ -2405,6 +2428,9 @@ int main(int argc, char **argv)
if (unused_exports_white_list)
handle_white_list_exports(unused_exports_white_list);
if (protected_modules_list)
handle_protected_modules_list(protected_modules_list);
list_for_each_entry(mod, &modules, list) {
if (mod->dump_file)
continue;