mirror of
https://github.com/dynup/kpatch
synced 2025-04-06 17:22:00 +00:00
kmod/core: move a couple of functions
Move kpatch_get_*_func a little higher in the file where they will be needed for the next commit.
This commit is contained in:
parent
2984b53d21
commit
48cc3a409e
@ -84,6 +84,29 @@ enum {
|
||||
};
|
||||
static atomic_t kpatch_operation;
|
||||
|
||||
static struct kpatch_func *kpatch_get_func(unsigned long ip)
|
||||
{
|
||||
struct kpatch_func *f;
|
||||
|
||||
/* Here, we have to use rcu safe hlist because of NMI concurrency */
|
||||
hash_for_each_possible_rcu(kpatch_func_hash, f, node, ip)
|
||||
if (f->old_addr == ip)
|
||||
return f;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct kpatch_func *kpatch_get_committed_func(struct kpatch_func *f,
|
||||
unsigned long ip)
|
||||
{
|
||||
/* Continuing on the same hlist to find commited (!updating) func */
|
||||
if (f) {
|
||||
hlist_for_each_entry_continue_rcu(f, node)
|
||||
if (f->old_addr == ip && !f->updating)
|
||||
return f;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void kpatch_backtrace_address_verify(void *data, unsigned long address,
|
||||
int reliable)
|
||||
{
|
||||
@ -214,29 +237,6 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct kpatch_func *kpatch_get_func(unsigned long ip)
|
||||
{
|
||||
struct kpatch_func *f;
|
||||
|
||||
/* Here, we have to use rcu safe hlist because of NMI concurrency */
|
||||
hash_for_each_possible_rcu(kpatch_func_hash, f, node, ip)
|
||||
if (f->old_addr == ip)
|
||||
return f;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct kpatch_func *kpatch_get_committed_func(struct kpatch_func *f,
|
||||
unsigned long ip)
|
||||
{
|
||||
/* Continuing on the same hlist to find commited (!updating) func */
|
||||
if (f) {
|
||||
hlist_for_each_entry_continue_rcu(f, node)
|
||||
if (f->old_addr == ip && !f->updating)
|
||||
return f;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is where the magic happens. Update regs->ip to tell ftrace to return
|
||||
* to the new function.
|
||||
|
Loading…
Reference in New Issue
Block a user