From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Petr Mladek <pmladek@suse.com>, Miroslav Benes <mbenes@suse.cz>,
Steven Rostedt <rostedt@goodmis.org>,
Jessica Yu <jeyu@kernel.org>, Jiri Kosina <jikos@kernel.org>,
Joe Lawrence <joe.lawrence@redhat.com>,
linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
Johannes Erdfelt <johannes@erdfelt.com>,
Ingo Molnar <mingo@kernel.org>,
mhiramat@kernel.org, torvalds@linux-foundation.org
Subject: Re: [PATCH 1/3] module: Fix livepatch/ftrace module text permissions race
Date: Wed, 26 Jun 2019 09:52:06 -0500 [thread overview]
Message-ID: <20190626145206.vqp4nivxva4oshvw@treble> (raw)
In-Reply-To: <alpine.DEB.2.21.1906261643200.32342@nanos.tec.linutronix.de>
On Wed, Jun 26, 2019 at 04:44:45PM +0200, Thomas Gleixner wrote:
> On Wed, 26 Jun 2019, Petr Mladek wrote:
> > On Wed 2019-06-26 10:22:45, Miroslav Benes wrote:
> > It is similar problem that has been solved by 2d1e38f56622b9bb5af8
> > ("kprobes: Cure hotplug lock ordering issues"). This commit solved
> > it by always taking cpu_hotplug_lock.rw_sem before text_mutex inside.
> >
> > If we follow the lock ordering then ftrace has to take text_mutex
> > only when stop_machine() is not called or from code called via
> > stop_machine() parameter.
> >
> > This is not easy with the current design. For example, arm calls
> > set_all_modules_text_rw() already in ftrace_arch_code_modify_prepare(),
> > see arch/arm/kernel/ftrace.c. And it is called:
> >
> > + outside stop_machine() from ftrace_run_update_code()
> > + without stop_machine() from ftrace_module_enable()
> >
> > A conservative solution for 5.2 release would be to move text_mutex
> > locking from the generic kernel/trace/ftrace.c into
> > arch/x86/kernel/ftrace.c:
> >
> > ftrace_arch_code_modify_prepare()
> > ftrace_arch_code_modify_post_process()
> >
> > It should be enough to fix the original problem because
> > x86 is the only architecture that calls set_all_modules_text_rw()
> > in ftrace path and supports livepatching at the same time.
>
> Looks correct, but I've paged out all the gory details vs. lock ordering in
> that area.
Looks good to me as well, Petr can you post a proper patch?
--
Josh
next prev parent reply other threads:[~2019-06-26 14:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 1:07 [PATCH 0/3] module: Livepatch/ftrace fixes Josh Poimboeuf
2019-06-14 1:07 ` [PATCH 1/3] module: Fix livepatch/ftrace module text permissions race Josh Poimboeuf
2019-06-14 21:04 ` Steven Rostedt
2019-06-26 8:22 ` Miroslav Benes
2019-06-26 13:37 ` Petr Mladek
2019-06-26 14:44 ` Thomas Gleixner
2019-06-26 14:52 ` Josh Poimboeuf [this message]
2019-06-26 14:59 ` Steven Rostedt
2019-06-14 1:07 ` [PATCH 2/3] module: Add text_mutex lockdep assertions for page attribute changes Josh Poimboeuf
2019-06-14 14:04 ` Petr Mladek
2019-06-14 18:21 ` Josh Poimboeuf
2019-06-14 1:07 ` [PATCH 3/3] module: Improve module __ro_after_init handling Josh Poimboeuf
2019-06-14 14:14 ` Petr Mladek
2019-06-14 18:23 ` Josh Poimboeuf
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=20190626145206.vqp4nivxva4oshvw@treble \
--to=jpoimboe@redhat.com \
--cc=jeyu@kernel.org \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=johannes@erdfelt.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®