From: Josef Bacik <josef@toxicpanda.com>
To: netdev@vger.kernel.org, mhiramat@kernel.org, ast@kernel.org,
daniel@iogearbox.net, darrick.wong@oracle.com,
linux-kernel@vger.kernel.org
Cc: Josef Bacik <jbacik@fb.com>
Subject: [PATCH] trace: reenable preemption if we modify the ip
Date: Fri, 15 Dec 2017 21:42:57 -0500 [thread overview]
Message-ID: <1513392177-10298-1-git-send-email-josef@toxicpanda.com> (raw)
From: Josef Bacik <jbacik@fb.com>
Things got moved around between the original bpf_override_return patches
and the final version, and now the ftrace kprobe dispatcher assumes if
you modified the ip that you also enabled preemption. Make a comment of
this and enable preemption, this fixes the lockdep splat that happened
when using this feature.
Signed-off-by: Josef Bacik <jbacik@fb.com>
---
kernel/trace/trace_kprobe.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 5db849809a56..91f4b57dab82 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1322,8 +1322,15 @@ static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs)
if (tk->tp.flags & TP_FLAG_TRACE)
kprobe_trace_func(tk, regs);
#ifdef CONFIG_PERF_EVENTS
- if (tk->tp.flags & TP_FLAG_PROFILE)
+ if (tk->tp.flags & TP_FLAG_PROFILE) {
ret = kprobe_perf_func(tk, regs);
+ /*
+ * The ftrace kprobe handler leaves it up to us to re-enable
+ * preemption here before returning if we've modified the ip.
+ */
+ if (ret)
+ preempt_enable_no_resched();
+ }
#endif
return ret;
}
--
2.7.5
next reply other threads:[~2017-12-16 2:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-16 2:42 Josef Bacik [this message]
2017-12-17 19:49 ` [PATCH] trace: reenable preemption if we modify the ip Daniel Borkmann
2017-12-18 7:29 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513392177-10298-1-git-send-email-josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=darrick.wong@oracle.com \
--cc=jbacik@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox