Skip to content

Commit dcf550e

Browse files
jpoimboeJiri Kosina
authored andcommitted
livepatch: Disallow vmlinux.ko
This is purely a theoretical issue, but if there were a module named vmlinux.ko, the livepatch relocation code wouldn't be able to distinguish between vmlinux-specific and vmlinux.o-specific KLP relocations. If CONFIG_LIVEPATCH is enabled, don't allow a module named vmlinux.ko. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent a811c1f commit dcf550e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/livepatch/core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,11 @@ int klp_module_coming(struct module *mod)
11391139
if (WARN_ON(mod->state != MODULE_STATE_COMING))
11401140
return -EINVAL;
11411141

1142+
if (!strcmp(mod->name, "vmlinux")) {
1143+
pr_err("vmlinux.ko: invalid module name");
1144+
return -EINVAL;
1145+
}
1146+
11421147
mutex_lock(&klp_mutex);
11431148
/*
11441149
* Each module has to know that klp_module_coming()

0 commit comments

Comments
 (0)