From: Masami Hiramatsu <mhiramat@kernel.org>
To: alexander.levin@verizon.com
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"ananth@linux.vnet.ibm.com" <ananth@linux.vnet.ibm.com>,
"mingo@kernel.org" <mingo@kernel.org>,
"naveen.n.rao@linux.vnet.ibm.com"
<naveen.n.rao@linux.vnet.ibm.com>,
"paulmck@linux.vnet.ibm.com" <paulmck@linux.vnet.ibm.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"stable-commits@vger.kernel.org" <stable-commits@vger.kernel.org>
Subject: Re: Patch "kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT=y" has been added to the 3.18-stable tree
Date: Thu, 7 Dec 2017 14:54:58 +0900 [thread overview]
Message-ID: <20171207145458.6842d36b644a8ce931189c7d@kernel.org> (raw)
In-Reply-To: <20171206233748.453o5qym6uraysyd@sasha-lappy>
On Wed, 6 Dec 2017 23:37:50 +0000
alexander.levin@verizon.com wrote:
> On Thu, Dec 07, 2017 at 08:27:37AM +0900, Masami Hiramatsu wrote:
> >Hi Greg,
> >
> >On Tue, 05 Dec 2017 18:30:54 +0100
> ><gregkh@linuxfoundation.org> wrote:
> >
> >>
> >> This is a note to let you know that I've just added the patch titled
> >>
> >> kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT=y
> >>
> >> to the 3.18-stable tree which can be found at:
> >> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kernel.org_git_-3Fp-3Dlinux_kernel_git_stable_stable-2Dqueue.git-3Ba-3Dsummary&d=DwICAg&c=udBTRvFvXC5Dhqg7UHpJlPps3mZ3LRxpb6__0PomBTQ&r=bUtaaC9mlBij4OjEG_D-KPul_335azYzfC4Rjgomobo&m=9-cmq2QbY49vsZXgMeNFamBo1WYKlpsVWfgnFtvHoG8&s=-feM_ZVFHDeIovYdEj2VhiuNt29qe-U1JXSuc-31dAA&e=
> >>
> >> The filename of the patch is:
> >> kprobes-use-synchronize_rcu_tasks-for-optprobe-with-config_preempt-y.patch
> >> and it can be found in the queue-3.18 subdirectory.
> >>
> >> If you, or anyone else, feels it should not be added to the stable tree,
> >> please let <stable@vger.kernel.org> know about it.
> >>
> >
> >This is not for bugfix, but improvement.
> >And also, it depends on TASKS_RCU & commit 7e42776d5ed1fe9a941ed8876c5d15cd7cf5d89f.
> >
> >So, please don't pull it on stable tree.
>
> Thanks for the clarification.
>
> Just to help me understand this better, what I understood from the
> patch is that we might execute freed trampoline memory, is that not
> the case here?
No, the patch is only for PREEMPT kernel. Without the patch, PREEMPT
kernel disables optprobe itself. On the other hand, non preempt kernel
enables optprobe but it uses synchronize_sched() for waiting quiesense
period, so that all interrupt routines are done and optprobe can free the
trampoline memory safely.
Note that non preempt kernel doesn't preempt tasks, it only interrupts
tasks and return soon (without task switching). But PREEMPT kernel can
preempt a task, this means a task can be interrupted and switched to
other task on the way of execution on trampoline memory. This requires
synchronize_rcu_tasks() to wait for switching back to the preempted
tasks.
The commit 7e42776d5ed exposes synchronize_rcu_tasks() as a alias of
synchronize_sched() when PREEMPT=n.
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2017-12-07 5:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 17:30 Patch "kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT=y" has been added to the 3.18-stable tree gregkh
2017-12-06 23:27 ` Masami Hiramatsu
2017-12-06 23:37 ` alexander.levin
2017-12-07 5:54 ` Masami Hiramatsu [this message]
2017-12-07 15:40 ` alexander.levin
2017-12-07 7:50 ` Greg KH
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=20171207145458.6842d36b644a8ce931189c7d@kernel.org \
--to=mhiramat@kernel.org \
--cc=alexander.levin@verizon.com \
--cc=ananth@linux.vnet.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=mingo@kernel.org \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=stable-commits@vger.kernel.org \
--cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).