[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <670124481.11073.1521146881571.JavaMail.zimbra@efficios.com>
Date: Thu, 15 Mar 2018 16:48:01 -0400 (EDT)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Oleg Nesterov <oleg@...hat.com>,
Erica Bugden <ebugden@...icios.com>
Cc: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
rostedt <rostedt@...dmis.org>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: uprobes misses breakpoint insertion into VM_WRITE mappings
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
Powered by blists - more mailing lists