Skip to content

Commit

Permalink
create-diff-object: ensure no data sections are included
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
jpoimboe committed May 30, 2014
1 parent ad8f229 commit 303928f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion kpatch-build/create-diff-object.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit 303928f

Please sign in to comment.