From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Oleg Nesterov <oleg@redhat.com>, Erica Bugden <ebugden@efficios.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: uprobes misses breakpoint insertion into VM_WRITE mappings
Date: Thu, 15 Mar 2018 16:48:01 -0400 (EDT) [thread overview]
Message-ID: <670124481.11073.1521146881571.JavaMail.zimbra@efficios.com> (raw)
Hi,
Erica has been working on extending test-cases for uprobes, and found
something unexpected:
Since commit e40cfce626a5 "uprobes: Restrict valid_vma(false) to skip VM_SHARED vmas"
uprobes does not insert breakpoints into mappings mprotect'd as writeable.
This issue can be reproduced by compiling a library without PIC (not using GOT),
and then concurrently:
A) Load the library (dynamic loader mprotect the code as writeable to do
the relocations, and then mprotect as executable),
B) Enable a uprobe through perf.
(it is a race window between the two mprotect syscalls)
It appears that the following restriction in valid_vma() is responsible
for this behavior:
if (is_register)
flags |= VM_WRITE;
I don't figure a clear explanation for this flag based on the function
comment nor the commit changelog. Any idea on whether this is really
needed ?
Note that on uprobes unregister, it allows removing a breakpoint event
on a writeable mapping, so there is clearly a discrepancy between the
level of paranoia associated with registration and unregistration.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next reply other threads:[~2018-03-15 20:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-15 20:48 Mathieu Desnoyers [this message]
2018-03-16 16:52 ` uprobes misses breakpoint insertion into VM_WRITE mappings Oleg Nesterov
2018-03-22 21:48 ` Mathieu Desnoyers
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=670124481.11073.1521146881571.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=ebugden@efficios.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
/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