mirror of https://github.com/dynup/kpatch
create-diff-object: Fix out-of-range relocation check
Improve the relocation check for the case where the referenced symbol isn't at the beginning of the section. Note that the check still isn't perfect, as many relocations have a negative addend. But it's still a lot better than nothing. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
parent
fa5a95cafd
commit
81f9ca4833
|
@ -2546,7 +2546,7 @@ static void kpatch_check_relocations(struct kpatch_elf *kelf)
|
|||
list_for_each_entry(rela, &sec->relas, list) {
|
||||
if (rela->sym->sec) {
|
||||
sdata = rela->sym->sec->data;
|
||||
if (rela->addend > (long)sdata->d_size) {
|
||||
if ((long)rela->sym->sym.st_value + rela->addend > (long)sdata->d_size) {
|
||||
ERROR("out-of-range relocation %s+%lx in %s", rela->sym->name,
|
||||
rela->addend, sec->name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue