This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH v3 2.6.39-rc1-tip 12/26] 12: uprobes: slot allocation for uprobes
- From: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>
- To: Eric Paris <eparis at redhat dot com>
- Cc: Eric Paris <eparis at parisplace dot org>, Peter Zijlstra <peterz at infradead dot org>, Ingo Molnar <mingo at elte dot hu>, Steven Rostedt <rostedt at goodmis dot org>, Linux-mm <linux-mm at kvack dot org>, Linus Torvalds <torvalds at linux-foundation dot org>, Jonathan Corbet <corbet at lwn dot net>, Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>, Thomas Gleixner <tglx at linutronix dot de>, Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, Oleg Nesterov <oleg at redhat dot com>, Andrew Morton <akpm at linux-foundation dot org>, SystemTap <systemtap at sources dot redhat dot com>, Jim Keniston <jkenisto at linux dot vnet dot ibm dot com>, Roland McGrath <roland at hack dot frob dot com>, Andi Kleen <andi at firstfloor dot org>, LKML <linux-kernel at vger dot kernel dot org>, sds at tycho dot nsa dot gov
- Date: Thu, 21 Apr 2011 22:29:45 +0530
- Subject: Re: [PATCH v3 2.6.39-rc1-tip 12/26] 12: uprobes: slot allocation for uprobes
- References: <20110401143223.15455.19844.sendpatchset@localhost6.localdomain6> <20110401143457.15455.64839.sendpatchset@localhost6.localdomain6> <1303145171.32491.886.camel@twins> <20110419062654.GB10698@linux.vnet.ibm.com> <BANLkTimw7dV9_aSsrUfzwSdwr6UwZDsRwg@mail.gmail.com> <20110421141125.GG10698@linux.vnet.ibm.com> <1303397133.1708.41.camel@unknown001a4b0c2895>
- Reply-to: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>
* Eric Paris <eparis@redhat.com> [2011-04-21 10:45:33]:
> > > 1) chcon -t unconfined_execmem_t /path/to/your/binary
> > > 2) setsebool -P allow_execmem 1
> > >
> > > The first will cause the binary to execute in a domain with
> > > permissions to execute anonymous memory, the second will allow all
> > > unconfined domains to execute anonymous memory.
> >
> > We arent restricted to a particular binary/binaries. We want an
> > infrastructure that can trace all user-space applications. So the
> > first option doesnt seem to help us.
> >
> > If I understand the second option. we would want this command to be
> > run on any selinux enabled machines that wants uprobes to be working.
>
> The check which I'm guessing you ran into problems is done using the
> permissions of the 'current' task. I don't know how your code works at
> all, but I would have guessed that the task allocating and adding this
> magic page was either perf or systemtap or something like that. Not the
> 'victim' task where the page would actually show up. Is that true? If
> so, method1 (or 2) works. If not, and 'current' is actually the victim,
> method2 would work some of the time, but not always.
The vma addition is done in the 'victim' context and not in the
debugger context. Victim hits the breakpoint and requests a
xol_vma for itself.
>
> If current can be the victim (or some completely random task) we can
> probably switch the credentials of the current task as we do the
> allocation to the initial creds (or something like that) so the
> permission will be granted.
Okay, I will use the switching the credentials logic.
>
> Unrelated note: I'd prefer to see that page be READ+EXEC only once it
> has been mapped into the victim task. Obviously the portion of the code
> that creates this page and sets up the instructions to run is going to
> need write. Maybe this isn't feasible. Maybe this magic pages gets
> written a lot even after it's been mapped in. But I'd rather, if
> possible, know that my victim tasks didn't have a WRITE+EXEC page
> available......
>
We dont need write permissions on this vma, READ+EXEC is good enuf.
As Roland said, userspace never writes to this vma.
--
Thanks and Regards
Srikar