lkml.org 
[lkml]   [2008]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] tracing/stack-tracer: fix locking

* Török Edwin <edwintorok@gmail.com> wrote:

> On 2008-11-23 13:01, Ingo Molnar wrote:
> > * Török Edwin <edwintorok@gmail.com> wrote:
> >
> >
> >> On 2008-11-23 12:52, Ingo Molnar wrote:
> >>
> >>> * Török Edwin <edwintorok@gmail.com> wrote:
> >>>
> >>>
> >>>
> >>>> + down_read(&mm->mmap_sem);
> >>>> + vma = find_vma(mm, ip);
> >>>> if (vma) {
> >>>> file = vma->vm_file;
> >>>> vmstart = vma->vm_start;
> >>>> }
> >>>> + up_read(&mm->mmap_sem);
> >>>> }
> >>>> if (file) {
> >>>> ret = trace_seq_path(s, &file->f_path);
> >>>>
> >>>>
> >>> and now it's "file" that is held without a reference and possibly
> >>> racy.
> >>>
> >>>
> >> I'll move the (file) inside the mmap_sem too, since file is part of
> >> vma, and you need mmap_sem to access the vma nobody can modify
> >> (file) if they don't hold mmap_sem. Am I right?
> >>
> >
> > yeah - you can use the mm lock for that as the vma holds a reference
> > to the file. This works as long as none of the seq functions called
> > with this lock held can provoke a user pagefault (they shouldnt, but i
> > havent checked in detail).
> >
>
> It calls d_path, that access only kernel structures AFAICT, so it
> can't provoke a *user* pagefault. Not sure about kernel pagefaults,
> but they shouldn't matter.

yeah - kernel pagefaults can happen in rare circumstances here but
they are all atomic and transparent to most other parts of the kernel
so they indeed do not matter.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-11-23 12:09    [W:0.167 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site