Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758527AbYKWLEU (ORCPT ); Sun, 23 Nov 2008 06:04:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756725AbYKWLEL (ORCPT ); Sun, 23 Nov 2008 06:04:11 -0500 Received: from fg-out-1718.google.com ([72.14.220.152]:9567 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756559AbYKWLEK (ORCPT ); Sun, 23 Nov 2008 06:04:10 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=MmRKKzwsu4vXmf6bS0V1TzN63d5UF+w/AgdRFiYPoXZRfIcJUCzsHodLWhGkcE3qud oaCvWDBjGvXCKJwqBIYH+v5StznOEIcsU+rGG+owP8UdO3MCQ1XJcl5vzjEhJuqk0FHT mSob+zu3PMnsFfvC23b3PijN9zu55wBWoLnY8= Message-ID: <492938A4.9020502@gmail.com> Date: Sun, 23 Nov 2008 13:04:04 +0200 From: =?ISO-8859-1?Q?T=F6r=F6k_Edwin?= User-Agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018) MIME-Version: 1.0 To: Ingo Molnar CC: srostedt@redhat.com, a.p.zijlstra@chello.nl, sandmann@daimi.au.dk, linux-kernel@vger.kernel.org, viro@ZenIV.linux.org.uk Subject: Re: [PATCH 2/3] tracing/stack-tracer: fix locking References: <20081123085310.GF30453@elte.hu> <1227436748-17075-2-git-send-email-edwintorok@gmail.com> <20081123105211.GC30453@elte.hu> <49293777.8070404@gmail.com> <20081123110114.GD30453@elte.hu> In-Reply-To: <20081123110114.GD30453@elte.hu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1485 Lines: 48 On 2008-11-23 13:01, Ingo Molnar wrote: > * T?r?k Edwin wrote: > > >> On 2008-11-23 12:52, Ingo Molnar wrote: >> >>> * T?r?k Edwin 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. Best regards, --Edwin -- 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/