fprobe: add unlock to match a succeeded ftrace_test_recursion_trylock

JIRA: https://issues.redhat.com/browse/RHEL-2373

commit 5f0c584daf7464f04114c65dd07269ee2bfedc13
Author: Ze Gao <zegao2021@gmail.com>
Date:   Mon Jul 3 17:23:36 2023 +0800

    fprobe: add unlock to match a succeeded ftrace_test_recursion_trylock

    Unlock ftrace recursion lock when fprobe_kprobe_handler() is failed
    because of some running kprobe.

    Link: https://lore.kernel.org/all/20230703092336.268371-1-zegao@tencent.com/

    Fixes: 3cc4e2c5fbae ("fprobe: make fprobe_kprobe_handler recursion free")
    Reported-by: Yafang <laoar.shao@gmail.com>
    Closes: https://lore.kernel.org/linux-trace-kernel/CALOAHbC6UpfFOOibdDiC7xFc5YFUgZnk3MZ=3Ny6we=AcrNbew@mail.gmail.com/
    Signed-off-by: Ze Gao <zegao@tencent.com>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Acked-by: Yafang Shao <laoar.shao@gmail.com>
    Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Signed-off-by: Viktor Malik <vmalik@redhat.com>
This commit is contained in:
Viktor Malik 2023-09-07 08:47:07 +02:00
parent 3a952231f4
commit d60a88cd31
No known key found for this signature in database
GPG Key ID: AF7A2E1F6EE74FB3
1 changed files with 3 additions and 1 deletions

View File

@ -90,12 +90,14 @@ static void fprobe_kprobe_handler(unsigned long ip, unsigned long parent_ip,
if (unlikely(kprobe_running())) {
fp->nmissed++;
return;
goto recursion_unlock;
}
kprobe_busy_begin();
__fprobe_handler(ip, parent_ip, ops, fregs);
kprobe_busy_end();
recursion_unlock:
ftrace_test_recursion_unlock(bit);
}