bugfix: correlate the rela sections of bundled static variables

If a static variable is a pointer, it has rela section.

Example:
	static int *p = &a;
changed to:
	static int *p = &b;
so its rela section has changed.

Then this change of data should be found and report error.
But if we don't correlate its rela section, we won't
find this change.

Signed-off-by: Zhou ChengMing <zhouchengming1@outlook.com>
This commit is contained in:
Zhou ChengMing 2015-09-25 08:02:27 -07:00
parent 667692639e
commit 0f556245e2
1 changed files with 5 additions and 0 deletions

View File

@ -1170,6 +1170,11 @@ void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
if (bundled) { if (bundled) {
sym->sec->twin = basesym->sec; sym->sec->twin = basesym->sec;
basesym->sec->twin = sym->sec; basesym->sec->twin = sym->sec;
if (sym->sec->rela && basesym->sec->rela) {
sym->sec->rela->twin = basesym->sec->rela;
basesym->sec->rela->twin = sym->sec->rela;
}
} }
} }
} }