From: Steven Rostedt <rostedt@goodmis.org>
To: "chengjian (D)" <cj.chengjian@huawei.com>
Cc: <linux-kernel@vger.kernel.org>, <huawei.libin@huawei.com>,
<xiexiuqi@huawei.com>, <mingo@redhat.com>,
<bobo.shaobowang@huawei.com>
Subject: Re: [PATCH] ftrace: enable trampoline when rec count decrement to one
Date: Wed, 8 May 2019 12:53:37 -0400 [thread overview]
Message-ID: <20190508125337.37777a2f@gandalf.local.home> (raw)
In-Reply-To: <e45dec40-d068-be47-7cbb-1b897e48c306@huawei.com>
On Wed, 8 May 2019 23:02:33 +0800
"chengjian (D)" <cj.chengjian@huawei.com> wrote:
> function tracer uses ftrace_caller() and livepatch uses
> ftrace_regs_caller().
>
> I can modify my testcase to trigger this race condition.
>
>
> #enable livepatch
> insmod klp_unshare_files.ko
> cat /sys/kernel/debug/tracing/enabled_functions
> unshare_files (1) R I tramp: 0xffffffffc0008000 (klp_ftrace_handler+0x0/0xa0) ->ftrace_ops_assist_func+0x0/0xf0
> [NOW, the rec caller is ftracer_regs_caller TRAMPOLINE]
>
> #function tracer
> echo unshare_files > /sys/kernel/debug/tracing/set_ftrace_filter
> echo function > /sys/kernel/debug/tracing/current_tracer
> cat /sys/kernel/debug/tracing/enabled_functions
> unshare_files (2) R I ->ftrace_ops_list_func+0x0/0x170
> [NOW, the rec caller is ftracer_regs_caller]
>
>
> # disable livepatch
> echo 0 > /sys/kernel/livepatch/klp_unshare_files/enabled
> rmmod klp_unshare_files
>
>
> cat /sys/kernel/debug/tracing/enabled_functions
> unshare_files (1) tramp: 0xffffffffc0005000 (function_trace_call+0x0/0x120) ->function_trace_call+0x0/0x120
> [NOW, the rec caller is ftrace_caller TRAMPOLINE]
>
> So, the caller switch from regs caller back to non regs caller
> when disable the livepatch. Could this testcase cause the race
> condition ? BUT, Nothing happened here.
>
> What will happen when the race triggers ? What can I do.
>
I still can't think of it. But since the merge window already opened,
I'd like to have this patch sit in linux-next for a bit. That is, I
would wait to pull it in for the next merge window, and not this one.
-- Steve
prev parent reply other threads:[~2019-05-08 16:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-04 11:39 Cheng Jian
2019-05-05 19:34 ` Steven Rostedt
2019-05-08 15:02 ` chengjian (D)
2019-05-08 16:53 ` Steven Rostedt [this message]
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=20190508125337.37777a2f@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=bobo.shaobowang@huawei.com \
--cc=cj.chengjian@huawei.com \
--cc=huawei.libin@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=xiexiuqi@huawei.com \
/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
all inboxes | Powered by JetHome®