From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>, Anton Arapov <aarapov@redhat.com>,
David Smith <dsmith@redhat.com>,
"Frank Ch. Eigler" <fche@redhat.com>,
Martin Cermak <mcermak@redhat.com>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] uprobes: Change uprobe_copy_process() to dup xol_area
Date: Mon, 14 Oct 2013 16:55:39 +0200 [thread overview]
Message-ID: <20131014145539.GA4319@redhat.com> (raw)
In-Reply-To: <20131014140942.GI28601@twins.programming.kicks-ass.net>
On 10/14, Peter Zijlstra wrote:
>
> On Sun, Oct 13, 2013 at 09:18:44PM +0200, Oleg Nesterov wrote:
> > This finally fixes the serious bug in uretprobes: a forked child
> > crashes if the parent called fork() with the pending ret probe.
> > ...
> >
> > Unfortunately, this also means that we can not handle the errors
> > properly, we obviously can not abort the already completed fork().
> > So we simply print the warning if GFP_KERNEL allocation (the only
> > possible reason) fails.
>
> Oh cute.. so we could actually ignore this perf_event_mmap() because we
> got it for the parent when we inserted the probe, and the perf tools
> assume the child mm layout is identical to the parent layout (it doesn't
> actually see the VM_DONTCOPY bit).
>
> So we could add: 'if (vma->vm_mm != current->mm) return;' to
> perf_event_mmap() with a very big nasty comment.
Perhaps. I can't really comment, but this is really nasty. I mean, this
simply doesn't look good. perf_event_mmap() will be reported or not
depending on how/why the task creates xol_area.
> That said; should we hide the XOL vma from perf altogether? That is; it
> will greatly obfuscate the perf data to get hits from the XOL table as
> we've got no means of mapping it back to an instruction.
Again, I can't really comment. But this creates the special case. OK,
xol_area is "special" anon mapping anyway, but still. And of course
this needs __install_special_mapping().
So I'd prefer to push these changes as is for now. GFP_KERNEL should
"never" fail and we need the fix for stable.
I agree, in the long term we should fix the inability to handle the
errors correctly. But this needs more changes and more uprobes hooks.
To simplify, suppose that we simply remove perf_event_mmap() from
install_special_mapping() (yes, wes, we cant'). Then we should:
1. revert 1/5, it already moves uprobe_copy_process() to the
point-of-no-return (for 4-5).
2. uprobe_copy_process() can avoid task_work_add() _and_ it can
return an error if dup_utask/dup_xol fails.
3. However, 2. means that we need to handle the potential errors
after uprobe_copy_process() suceeds. This means we need, say,
uprobe_abort_fork() somewhere near bad_fork_cleanup_mm.
So will you agree with task_work for now?
Oleg.
next prev parent reply other threads:[~2013-10-14 15:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-13 19:18 [PATCH 0/5] uprobes: fix fork() with the pending ret-probe(s) Oleg Nesterov
2013-10-13 19:18 ` [PATCH 1/5] uprobes: Change the callsite of uprobe_copy_process() Oleg Nesterov
2013-10-16 12:37 ` Srikar Dronamraju
2013-10-13 19:18 ` [PATCH 2/5] uprobes: Introduce __create_xol_area() Oleg Nesterov
2013-10-16 12:41 ` Srikar Dronamraju
2013-10-16 12:50 ` Srikar Dronamraju
2013-10-13 19:18 ` [PATCH 3/5] uprobes: Teach __create_xol_area() to accept the predefined vaddr Oleg Nesterov
2013-10-16 12:43 ` Srikar Dronamraju
2013-10-13 19:18 ` [PATCH 4/5] uprobes: Change uprobe_copy_process() to dup return_instances Oleg Nesterov
2013-10-14 18:45 ` Peter Zijlstra
2013-10-14 19:00 ` Oleg Nesterov
2013-10-16 12:47 ` Srikar Dronamraju
2013-10-13 19:18 ` [PATCH 5/5] uprobes: Change uprobe_copy_process() to dup xol_area Oleg Nesterov
2013-10-14 14:09 ` Peter Zijlstra
2013-10-14 14:55 ` Oleg Nesterov [this message]
2013-10-14 15:47 ` Peter Zijlstra
2013-10-16 12:53 ` Srikar Dronamraju
2013-10-16 16:09 ` Oleg Nesterov
2013-10-18 15:49 ` Oleg Nesterov
2013-10-14 18:29 ` [PATCH 0/5] uprobes: fix fork() with the pending ret-probe(s) Oleg Nesterov
2013-10-16 17:38 ` Oleg Nesterov
2013-10-16 17:39 ` [PATCH 6/5] uprobes: Teach uprobe_copy_process() to handle CLONE_VFORK Oleg Nesterov
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=20131014145539.GA4319@redhat.com \
--to=oleg@redhat.com \
--cc=aarapov@redhat.com \
--cc=dsmith@redhat.com \
--cc=fche@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mcermak@redhat.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
/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).