Skip to content

Commit 562875e

Browse files
committed
add inl_within_trampoline.
1 parent 238e4b5 commit 562875e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

inl_hook.c

+20
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,26 @@ static void hook_restore(struct hook_item *item)
237237
}
238238

239239

240+
int inl_within_trampoline(unsigned long address)
241+
{
242+
long bytes;
243+
struct hook_item *item;
244+
unsigned long start, end;
245+
246+
list_for_each_entry(item, &hook_list, list) {
247+
bytes = item->stolen + HOOK_MAX_CODE_BYTES;
248+
start = (unsigned long)item->trampoline;
249+
end = (unsigned long)item->trampoline + bytes;
250+
251+
if (address >= start && address < end) {
252+
return -EBUSY;
253+
}
254+
}
255+
256+
return 0;
257+
}
258+
259+
240260
int inl_sethook(void **orig, void *hook)
241261
{
242262
u32 instr_len;

inl_hook.h

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
int inl_sethook(void **orig, void *hook);
55
int inl_unhook(void *hook);
6+
int inl_within_trampoline(unsigned long address);
67

78
#endif
89

0 commit comments

Comments
 (0)