mirror of https://github.com/dynup/kpatch
fix bugs
- fix real issue with 0's in the middle of a merged section (wrong alignment) - show patch util output in case it asks a question so it doesn't silently fail - fix issue with relocation of local objects (because they become global objects)
This commit is contained in:
parent
16647ccf89
commit
0cf58eea37
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue