diff options
author | Zhou Chengming <[email protected]> | 2015-11-06 14:25:00 +0800 |
---|---|---|
committer | Jiri Kosina <[email protected]> | 2015-11-11 17:36:04 +0100 |
commit | e41b104c7dba92443e594e6bc86e4b0bf1cdf573 (patch) | |
tree | 1793ed3dbe6268a7e153afb60812e1d85b84c18f | |
parent | 99aaa9c64be5fe728975109c96ef297f5650883d (diff) |
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.
[[email protected]: extended / reworded changelog a bit]
Reported-by: Cyril B. <[email protected]>
Signed-off-by: Zhou Chengming <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
-rw-r--r-- | kernel/livepatch/core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 6e5344112419..db545cbcdb89 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -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) |