diff --git a/kmod/base.c b/kmod/base.c index 407c115..4ba9c2d 100644 --- a/kmod/base.c +++ b/kmod/base.c @@ -164,10 +164,6 @@ int kpatch_register(struct module *mod, void *kpatch_relas, /* TODO: ensure dest value is all zeros before touching it, and that it's within the module bounds */ for (i = 0; i < num_relas; i++) { - /* combined .o files have gaps */ - if (!relas[i].type && !relas[i].src && !relas[i].dest) - continue; - switch (relas[i].type) { case R_X86_64_PC32: loc = (void *)relas[i].dest; @@ -208,10 +204,6 @@ int kpatch_register(struct module *mod, void *kpatch_relas, funcs = kmalloc((num_patches + 1) * sizeof(*funcs), GFP_KERNEL); /*TODO: error handling, free, etc */ for (i = 0; i < num_patches; i++) { - /* combined .o files have gaps */ - if (!patches[i].orig && !patches[i].new) - continue; - funcs[i].old_func_addr = patches[i].orig; funcs[i].new_func_addr = patches[i].new; funcs[i].mod = mod; diff --git a/kpatch-create b/kpatch-create index 7e4935f..993fad9 100755 --- a/kpatch-create +++ b/kpatch-create @@ -55,7 +55,7 @@ cleanup () cleanup_objs if [ $PATCHED ]; then cd "$KERNEL_DIR" - patch -p1 -R < "$PATCH" > /dev/null + patch -p1 -R < "$PATCH" export CROSS_COMPILE="$KPATCHGCC " $MAKE_CMD > /dev/null fi @@ -99,7 +99,7 @@ $MAKE_CMD > /dev/null cp vmlinux vmlinux.kpatch_orig scriptecho "patching kernel" -patch -p1 < "$PATCH" > /dev/null +patch -p1 < "$PATCH" PATCHED=1 scriptecho "compiling patched kernel" diff --git a/kpatch-diff-gen/kpatch-diff-gen.c b/kpatch-diff-gen/kpatch-diff-gen.c index 0f8bff6..85f7863 100644 --- a/kpatch-diff-gen/kpatch-diff-gen.c +++ b/kpatch-diff-gen/kpatch-diff-gen.c @@ -1374,7 +1374,8 @@ int main(int argc, char *argv[]) if (!rela->dest_sym->diff) continue; - if (rela->src_sym->bind != STB_LOCAL) { + if (rela->src_sym->bind != STB_LOCAL || + rela->src_sym->type == STT_OBJECT) { rela->kpatch_rela = malloc(sizeof(*rela->kpatch_rela)); rela->kpatch_rela->type = rela->type; rela->kpatch_rela->dest = 0; @@ -1405,7 +1406,7 @@ int main(int argc, char *argv[]) sec->data->d_type = ELF_T_BYTE; /* TODO? */ sec->sh.sh_type = SHT_PROGBITS; sec->sh.sh_name = kpatch_relas_sec_strndx; - sec->sh.sh_addralign = kpatch_rela_size; + sec->sh.sh_addralign = 8; sec->sh.sh_entsize = kpatch_rela_size; sec->sh.sh_flags = SHF_ALLOC; index = 0; @@ -1488,7 +1489,7 @@ int main(int argc, char *argv[]) sec->sh.sh_type = SHT_PROGBITS; sec->sh.sh_name = kpatch_patches_sec_strndx; sec->sh.sh_entsize = sizeof(struct kpatch_patch); - sec->sh.sh_addralign = sec->sh.sh_entsize; + sec->sh.sh_addralign = 8; sec->sh.sh_flags = SHF_ALLOC; index = 0; for (sym = symso; sym; sym = sym->next) {