Skip to content

Commit

Permalink
livepatch: Disallow vmlinux.ko
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Josh Poimboeuf <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Acked-by: Joe Lawrence <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
jpoimboe authored and Jiri Kosina committed May 7, 2020
1 parent a811c1f commit dcf550e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/livepatch/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,11 @@ int klp_module_coming(struct module *mod)
if (WARN_ON(mod->state != MODULE_STATE_COMING))
return -EINVAL;

if (!strcmp(mod->name, "vmlinux")) {
pr_err("vmlinux.ko: invalid module name");
return -EINVAL;
}

mutex_lock(&klp_mutex);
/*
* Each module has to know that klp_module_coming()
Expand Down

0 comments on commit dcf550e

Please sign in to comment.