Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756507Ab0FYV3u (ORCPT ); Fri, 25 Jun 2010 17:29:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2220 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751103Ab0FYV3t (ORCPT ); Fri, 25 Jun 2010 17:29:49 -0400 Date: Fri, 25 Jun 2010 23:27:59 +0200 From: Oleg Nesterov To: Sukadev Bhattiprolu Cc: "Eric W. Biederman" , Pavel Emelyanov , Andrew Morton , Linux Containers , linux-kernel@vger.kernel.org Subject: Re: [RESEND PATCH] pid_ns: Fix proc_flush_task() accessing freed proc_mnt Message-ID: <20100625212758.GA30474@redhat.com> References: <20100623203652.GA25298@redhat.com> <1277399329-18087-1-git-send-email-louis.rilling@kerlabs.com> <20100624191843.GA14205@redhat.com> <20100625102303.GG3773@hawkmoon.kerlabs.com> <20100625183733.GA2627@us.ibm.com> <20100625192945.GA25532@redhat.com> <20100625212618.GA11917@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100625212618.GA11917@us.ibm.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1352 Lines: 43 On 06/25, Sukadev Bhattiprolu wrote: > > Oleg Nesterov [oleg@redhat.com] wrote: > | On 06/25, Sukadev Bhattiprolu wrote: > | > > | > Louis Rilling [Louis.Rilling@kerlabs.com] wrote: > | > | - proc_pid_readdir(): > | > | Needs similar check and protection to proc_pid_lookup(), but there is another > | > | issue: next_tgid() can find a dying task: > | > > | > Hmm, I thought proc_pid_readdir() would be a problem too but convinced myself > | > that it would not - since a process running proc_pid_readdir() would have > | > a reference to the pid namespace, > | > | Where does this reference comes from ? > > Caller of proc_pid_readdir() would be living in the same pid namespace right ? Afaics, in general not. Suppose that we do something like if (!clone(CLONE_NEWPID)) { mount("none", "/SUB_PROC", "proc", 0, NULL); exit(); } After that /SUB_PROC/ still exists, one can do "ls /SUB_PROC/". This particular case is fine, ns->child_reaper was already cleared. But, as Louis pointed out, ls can race with the exiting init. > | But I won't be surprised if I am wrong again ;) Yes ;) Oleg. -- 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/