Skip to content

Commit be243ba

Browse files
zegao96mhiramat
authored andcommitted
rethook: use preempt_{disable, enable}_notrace in rethook_trampoline_handler
This patch replaces preempt_{disable, enable} with its corresponding notrace version in rethook_trampoline_handler so no worries about stack recursion or overflow introduced by preempt_count_{add, sub} under fprobe + rethook context. Link: https://lore.kernel.org/all/[email protected]/ Fixes: 54ecbe6 ("rethook: Add a generic return hook") Signed-off-by: Ze Gao <[email protected]> Acked-by: Masami Hiramatsu (Google) <[email protected]> Cc: <[email protected]> Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent 6049674 commit be243ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/rethook.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ unsigned long rethook_trampoline_handler(struct pt_regs *regs,
288288
* These loops must be protected from rethook_free_rcu() because those
289289
* are accessing 'rhn->rethook'.
290290
*/
291-
preempt_disable();
291+
preempt_disable_notrace();
292292

293293
/*
294294
* Run the handler on the shadow stack. Do not unlink the list here because
@@ -321,7 +321,7 @@ unsigned long rethook_trampoline_handler(struct pt_regs *regs,
321321
first = first->next;
322322
rethook_recycle(rhn);
323323
}
324-
preempt_enable();
324+
preempt_enable_notrace();
325325

326326
return correct_ret_addr;
327327
}

0 commit comments

Comments
 (0)