mirror of
https://github.com/dynup/kpatch
synced 2024-12-27 15:52:02 +00:00
Merge pull request #237 from jpoimboe/activeness-safety-print-func
kmod/core: print func name on activeness safety failure
This commit is contained in:
commit
ba7038052f
@ -181,12 +181,11 @@ static struct kpatch_func *kpatch_get_prev_func(struct kpatch_func *f,
|
|||||||
|
|
||||||
static inline int kpatch_compare_addresses(unsigned long stack_addr,
|
static inline int kpatch_compare_addresses(unsigned long stack_addr,
|
||||||
unsigned long func_addr,
|
unsigned long func_addr,
|
||||||
unsigned long func_size)
|
unsigned long func_size,
|
||||||
|
char *func_name)
|
||||||
{
|
{
|
||||||
if (stack_addr >= func_addr && stack_addr < func_addr + func_size) {
|
if (stack_addr >= func_addr && stack_addr < func_addr + func_size) {
|
||||||
/* TODO: use kallsyms to print symbol name */
|
pr_err("activeness safety check failed for %s\n", func_name);
|
||||||
pr_err("activeness safety check failed for function at address 0x%lx\n",
|
|
||||||
stack_addr);
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -206,6 +205,7 @@ static void kpatch_backtrace_address_verify(void *data, unsigned long address,
|
|||||||
/* check kpmod funcs */
|
/* check kpmod funcs */
|
||||||
for (i = 0; i < kpmod->patches_nr; i++) {
|
for (i = 0; i < kpmod->patches_nr; i++) {
|
||||||
unsigned long func_addr, func_size;
|
unsigned long func_addr, func_size;
|
||||||
|
char *func_name;
|
||||||
struct kpatch_func *active_func;
|
struct kpatch_func *active_func;
|
||||||
|
|
||||||
func = &kpmod->internal->funcs[i];
|
func = &kpmod->internal->funcs[i];
|
||||||
@ -214,14 +214,16 @@ static void kpatch_backtrace_address_verify(void *data, unsigned long address,
|
|||||||
/* patching an unpatched func */
|
/* patching an unpatched func */
|
||||||
func_addr = func->old_addr;
|
func_addr = func->old_addr;
|
||||||
func_size = func->patch->old_size;
|
func_size = func->patch->old_size;
|
||||||
|
func_name = func->patch->name;
|
||||||
} else {
|
} else {
|
||||||
/* repatching or unpatching */
|
/* repatching or unpatching */
|
||||||
func_addr = active_func->patch->new_addr;
|
func_addr = active_func->patch->new_addr;
|
||||||
func_size = active_func->patch->new_size;
|
func_size = active_func->patch->new_size;
|
||||||
|
func_name = active_func->patch->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
args->ret = kpatch_compare_addresses(address, func_addr,
|
args->ret = kpatch_compare_addresses(address, func_addr,
|
||||||
func_size);
|
func_size, func_name);
|
||||||
if (args->ret)
|
if (args->ret)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -231,7 +233,8 @@ static void kpatch_backtrace_address_verify(void *data, unsigned long address,
|
|||||||
if (func->op == KPATCH_OP_UNPATCH) {
|
if (func->op == KPATCH_OP_UNPATCH) {
|
||||||
args->ret = kpatch_compare_addresses(address,
|
args->ret = kpatch_compare_addresses(address,
|
||||||
func->patch->new_addr,
|
func->patch->new_addr,
|
||||||
func->patch->new_size);
|
func->patch->new_size,
|
||||||
|
func->patch->name);
|
||||||
if (args->ret)
|
if (args->ret)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user