mirror of
https://github.com/dynup/kpatch
synced 2024-12-12 00:14:35 +00:00
create-diff-object: ensure no data sections are included
When a changed function needs relocations for special data sections like .data..percpu or .data..read_mostly, it's possible for those sections to get included. We try to avoid that situation by converting section references to data symbol references in kpatch_replace_sections_syms(), but the conversion success rate isn't 100%, and we could be forgetting about some other sections, so ensure that it never happens in kpatch_verify_patchability().
This commit is contained in:
parent
ad8f2299ef
commit
303928f634
@ -790,12 +790,23 @@ void kpatch_verify_patchability(struct kpatch_elf *kelf)
|
||||
struct section *sec;
|
||||
int errs = 0;
|
||||
|
||||
list_for_each_entry(sec, &kelf->sections, list)
|
||||
list_for_each_entry(sec, &kelf->sections, list) {
|
||||
if (sec->status == CHANGED && !sec->include) {
|
||||
log_normal("%s: changed section %s not selected for inclusion\n",
|
||||
objname, sec->name);
|
||||
errs++;
|
||||
}
|
||||
|
||||
/* ensure we aren't including .data.* or .bss.* */
|
||||
if (sec->include &&
|
||||
(!strncmp(sec->name, ".data", 5) ||
|
||||
!strncmp(sec->name, ".bss", 4))) {
|
||||
log_normal("%s: data section %s selected for inclusion\n",
|
||||
objname, sec->name);
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
|
||||
if (errs)
|
||||
DIFF_FATAL("%d unsupported section change(s)", errs);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user