]> Git Repo - linux.git/commitdiff
livepatch: x86: fix relocation computation with kASLR
authorZhou Chengming <[email protected]>
Fri, 6 Nov 2015 06:25:00 +0000 (14:25 +0800)
committerJiri Kosina <[email protected]>
Wed, 11 Nov 2015 16:36:04 +0000 (17:36 +0100)
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]>
kernel/livepatch/core.c

index 6e5344112419ca43ace3474466db35d1692752ab..db545cbcdb8933e1ab4b95a9c276eb523de8ba43 100644 (file)
@@ -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)
This page took 0.056805 seconds and 4 git commands to generate.