mirror of https://github.com/dynup/kpatch
add address end to fix activeness safety check
This commit is contained in:
parent
0cf58eea37
commit
12fb573fca
|
@ -205,6 +205,7 @@ int kpatch_register(struct module *mod, void *kpatch_relas,
|
||||||
for (i = 0; i < num_patches; i++) {
|
for (i = 0; i < num_patches; i++) {
|
||||||
|
|
||||||
funcs[i].old_func_addr = patches[i].orig;
|
funcs[i].old_func_addr = patches[i].orig;
|
||||||
|
funcs[i].old_func_addr_end = patches[i].orig_end;
|
||||||
funcs[i].new_func_addr = patches[i].new;
|
funcs[i].new_func_addr = patches[i].new;
|
||||||
funcs[i].mod = mod;
|
funcs[i].mod = mod;
|
||||||
funcs[i].old_func_name = "TODO";
|
funcs[i].old_func_name = "TODO";
|
||||||
|
|
|
@ -19,6 +19,7 @@ struct kpatch_rela {
|
||||||
struct kpatch_patch {
|
struct kpatch_patch {
|
||||||
unsigned long new;
|
unsigned long new;
|
||||||
unsigned long orig; /* TODO eventually add name of symbol so we can verify it with kallsyms */
|
unsigned long orig; /* TODO eventually add name of symbol so we can verify it with kallsyms */
|
||||||
|
unsigned long orig_end; /* TODO: rename this struct to kpatch_func, embed it within original kpatch_func, and rename original kpatch_func to kpatch_func_reg? */
|
||||||
};
|
};
|
||||||
|
|
||||||
void kpatch_trampoline(unsigned long ip, unsigned long parent_ip,
|
void kpatch_trampoline(unsigned long ip, unsigned long parent_ip,
|
||||||
|
|
|
@ -111,11 +111,11 @@ scriptecho "diffing binaries"
|
||||||
find . -type f -name '*.o.kpatch_orig' | while read file; do
|
find . -type f -name '*.o.kpatch_orig' | while read file; do
|
||||||
origfile="${file#./}"
|
origfile="${file#./}"
|
||||||
newfile="${origfile%.kpatch_orig}"
|
newfile="${origfile%.kpatch_orig}"
|
||||||
[ ! -f "$newfile" ] && die "can't find \"$newfile\""
|
[ ! -f "$newfile" ] && die "can't find $newfile"
|
||||||
num="`readelf -s \"$file\" |awk '{print $4}' |grep -c FILE`"
|
num="`readelf -s \"$file\" |awk '{print $4}' |grep -c FILE`"
|
||||||
[ "$num" = 0 ] && die "unsupported change in (assembly?) file \"$file\""
|
[ "$num" = 0 ] && die "unsupported change in (assembly?) file $file"
|
||||||
[ "$num" -gt 1 ] && die "\"$newfile\" has too many FILE symbols"
|
[ "$num" -gt 1 ] && die "$newfile has too many FILE symbols"
|
||||||
scriptecho "object changed: \"$newfile\""
|
scriptecho "object changed: $newfile"
|
||||||
"$KPATCH_GEN" "$origfile" "$newfile" -v vmlinux.kpatch_orig -o "$newfile.kpatch_gen"
|
"$KPATCH_GEN" "$origfile" "$newfile" -v vmlinux.kpatch_orig -o "$newfile.kpatch_gen"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ struct rela {
|
||||||
struct kpatch_patch {
|
struct kpatch_patch {
|
||||||
unsigned long new; /* TODO don't rely on this being the first */
|
unsigned long new; /* TODO don't rely on this being the first */
|
||||||
unsigned long orig; /* TODO eventually add name of symbol so we can verify it with kallsyms */
|
unsigned long orig; /* TODO eventually add name of symbol so we can verify it with kallsyms */
|
||||||
|
unsigned long orig_end;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1497,6 +1498,7 @@ int main(int argc, char *argv[])
|
||||||
continue;
|
continue;
|
||||||
patch = sec->data->d_buf + (index * sec->sh.sh_entsize);
|
patch = sec->data->d_buf + (index * sec->sh.sh_entsize);
|
||||||
patch->orig = sym->twino->twinv->sym.st_value;
|
patch->orig = sym->twino->twinv->sym.st_value;
|
||||||
|
patch->orig_end = patch->orig + sym->sym.st_size;
|
||||||
patch->new = 0;
|
patch->new = 0;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue