Merge pull request #1172 from jpoimboe/out-of-range-rela-fix

A couple of fixes for the out-of-range relocation check
This commit is contained in:
Joe Lawrence 2021-05-05 12:35:26 -04:00 committed by GitHub
commit 97b69bee75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2546,8 +2546,8 @@ 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) {
ERROR("out-of-range relocation %s+%lx in %s", rela->sym->sec->name,
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);
}
}