Commit e41b104c authored by Zhou Chengming's avatar Zhou Chengming Committed by Jiri Kosina

livepatch: x86: fix relocation computation with kASLR

With kASLR enabled, old_addr provided by patch module is being shifted
accrodingly so that the symbol lookups work. To have module relocations
handled properly as well, the same transformation needs to be perfomed
on relocation address information.

[jkosina@suse.cz: extended / reworded changelog a bit]
Reported-by: default avatarCyril B. <cbay@alwaysdata.com>
Signed-off-by: default avatarZhou Chengming <zhouchengming1@huawei.com>
Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 99aaa9c6
......@@ -294,6 +294,12 @@ static int klp_write_object_relocations(struct module *pmod,
for (reloc = obj->relocs; reloc->name; reloc++) {
if (!klp_is_module(obj)) {
#if defined(CONFIG_RANDOMIZE_BASE)
/* If KASLR has been enabled, adjust old value accordingly */
if (kaslr_enabled())
reloc->val += kaslr_offset();
#endif
ret = klp_verify_vmlinux_symbol(reloc->name,
reloc->val);
if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment