Skip to content

Commit d9bf296

Browse files
committed
Merge tag 'probes-fixes-v7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull probes fixes from Masami Hiramatsu: - Avoid crash when rmmod/insmod after ftrace killed This fixes a kernel crash caused by kprobes on the symbol in a module which is unloaded after ftrace_kill() is called. - Remove unneeded warnings from __arm_kprobe_ftrace() Remove unneeded WARN messages which can be triggered if the kprobe is using ftrace and it fails to enable the ftrace. Since kprobes correctly handle such failure, we don't need to warn it. * tag 'probes-fixes-v7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: kprobes: Remove unneeded warnings from __arm_kprobe_ftrace() kprobes: avoid crash when rmmod/insmod after ftrace killed
2 parents 62cda74 + 5ef268c commit d9bf296

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

kernel/kprobes.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,12 +1144,12 @@ static int __arm_kprobe_ftrace(struct kprobe *p, struct ftrace_ops *ops,
11441144
lockdep_assert_held(&kprobe_mutex);
11451145

11461146
ret = ftrace_set_filter_ip(ops, (unsigned long)p->addr, 0, 0);
1147-
if (WARN_ONCE(ret < 0, "Failed to arm kprobe-ftrace at %pS (error %d)\n", p->addr, ret))
1147+
if (ret < 0)
11481148
return ret;
11491149

11501150
if (*cnt == 0) {
11511151
ret = register_ftrace_function(ops);
1152-
if (WARN(ret < 0, "Failed to register kprobe-ftrace (error %d)\n", ret)) {
1152+
if (ret < 0) {
11531153
/*
11541154
* At this point, sinec ops is not registered, we should be sefe from
11551155
* registering empty filter.
@@ -1178,6 +1178,10 @@ static int __disarm_kprobe_ftrace(struct kprobe *p, struct ftrace_ops *ops,
11781178
int ret;
11791179

11801180
lockdep_assert_held(&kprobe_mutex);
1181+
if (unlikely(kprobe_ftrace_disabled)) {
1182+
/* Now ftrace is disabled forever, disarm is already done. */
1183+
return 0;
1184+
}
11811185

11821186
if (*cnt == 1) {
11831187
ret = unregister_ftrace_function(ops);

0 commit comments

Comments
 (0)